DEV Community

Teaching Git Some New Tricks

Jonathan Irvin on July 20, 2018

First (second) dev.to article! Learn to hit the save button, Jonathan! You can create aliases both on the repo level and globally just by adding...
Collapse
 
bradbodine-dev profile image
Brad Bodine

That is good stuff, the only issue with this is that if you become dependent on these specific commands and you have to use a different environment (someone else's machine) you could forget the actual commands.

I use text expander on osx to do similar things with common git commands.

Just something to keep in mind. 😁

Collapse
 
qm3ster profile image
Mihail Malo

You could always quickly source your alias config from let's say a gist.

Collapse
 
offendingcommit profile image
Jonathan Irvin

Oh yeah, for sure. I strongly advocate learning the commands before making an alias. But if you switch workspaces as much as I do, I'm creating aliases as much as I'm typing the full command.

Collapse
 
ramlev profile image
Hasse R. Hansen

typo: git log --online should be git log --oneline

Collapse
 
hoelzro profile image
Rob Hoelz

Haha, I mistype that one so much that I define online as an alias for oneline in my gitconfig!

Collapse
 
offendingcommit profile image
Jonathan Irvin

Haha! Oops! Thanks for catching that!

Collapse
 
offendingcommit profile image
Jonathan Irvin

Fixed.

Collapse
 
marsavela profile image
Sergiu Marsavela

I always end up relying on *sh aliases rather than using git's alias. In the end, gs or gst is still better than git st to me.

Collapse
 
ronokdev profile image
Farhan

Great Stuff !! Thanks.

Collapse
 
iamchandankr profile image
Kumar Chandan

Thanks for writeup.
It would help if guidelines to undo the global alias set up is given here as well.

Collapse
 
jeklah profile image
Jeklah

One of my favourites is git config --global alias.oops "commit --amend --no-edit"

Collapse
 
qm3ster profile image
Mihail Malo

Interesting that git has this feature.
What is the advantage over just using shell aliases? Does autocompletion work in one case but not the other?