DEV Community

Discussion on: Using Aliases to Speed Up Your Git Workflow

Collapse
 
ben profile image
Ben Halpern

This also acts as sort of a cheatsheet for things you might want to be doing in the first place, while giving a more compact command to do so.

Not everybody loves aliases, but this looks like a great guideline for those who do or want to start.

Collapse
 
robertcoopercode profile image
Robert Cooper

Not everybody loves aliases

This is true. I worked with a guy that refused to use aliases because he thought he would forget the underlying command behind the alias.

Collapse
 
jbristow profile image
Jon Bristow • Edited

It’s less that and more having your muscle memory be completely wrong as soon as you ssh somewhere.

Aliases are ok... but anyone with a bloated vimrc file can tell you how strange it feels to use the defaults. (Seriously, using vim-surround is basically the main reason I still use vim)

EDIT: and typing git commands are a very small part of my workflow, so it seems wasteful to alias them. And I will absolutely never add -A... I’m too paranoid about committing something I didn’t mean to.

Thread Thread
 
codeandclay profile image
Oliver

I don't have many aliases for git commands but seeing git add -A has inspired me to add one more to my small list:

alias gip='git add ${FILE} -p'

As in: git add file.rb -p. The -p flag tells git that you want to select which individual lines/hunks get committed. It's the scalpel to -A's mallet.

The alias allows me to do it this way: gip file.rb

Thread Thread
 
jbristow profile image
Jon Bristow

SInce i work in feature branches that get squash merged in a few days, I don’t really understand why you would be doing more than one thing at once...

Thread Thread
 
jessekphillips profile image
Jesse Phillips

I don't think squash merge should exist. The commit message sucks, many times your feature can be good individual changes (valuable outside the feature) it is pretty easy to finalize the order and squash with a rebase --interactive.

I'm said --fixup isn't listed as as alias.

Collapse
 
alainvanhout profile image
Alain Van Hout

My general opinion is very much 'use whatever works best for you'.

For me personally though, aliases like this are equivalent to improving the speed/performance of your car by speeding up how quickly you can get into and out of the car.

Collapse
 
aurelkurtula profile image
aurel kurtula

Haha, that's why I bookmarked it. Apart from add, commit -a -m, push --all and branching I do nothing else. And that I think is powerful, I only imagine how much power I'd get if I could be bothered learning the rest.