loading...

Discussion on: My Personal Git Tricks Cheatsheet

Collapse
goodevilgenius profile image
Dan Jones

Why use shell aliases for something that's git specific? You can just use git aliases.

Instead of:

alias git-branch="git branch | sed -n -e 's/^\* \(.*\)/\1/p'"

Do:


git config --global alias.this-branch '!'"git branch | sed -n 's/^\* \(.*\)/\1/p'"

Now, from within any repo, you can run git this-branch, and you didn't have to add anything to your shell, and if you switch shells, it will continue to work.

Collapse
antjanus profile image
Antonin Januska Author

That's pretty cool! I basically just learned about that from people on this post