DEV Community

Discussion on: 10 insanely useful Git commands you wish existed – and their alternatives

Collapse
 
mfrata profile image
Matheus Frata

Great post Eyar!!

You could have mentioned the git alias feature, in order to use these in a much more intuitive way. For instance, I have set git uncommit just like you mentioned:

  • uncommit = reset HEAD^

There are others that are useful for me:

History tree

  • tree = log --oneline --graph --decorate

Intuitive way to unstage files

  • unstage = reset HEAD --

Show the current aliases

  • alias = config --get-regexp ^alias\\.

Restore deleted file from upstream

  • restore = "!git checkout $(git upstream) -- #@"

... which depends on

  • upstream = rev-parse --abbrev-ref --symbolic-full-name @{u}
Collapse
 
eyarz profile image
Eyar Zilberman

I wanted to add information regarding the alias feature, but I was afraid it would make the post too much long for reading.

I will update the post, and I will add a link to your comment so readers will still have a reference for git alias - thanks!