The Git Aliases That Get Me To Friday
In the last few years since switching from SVN to Git, I’ve picked up a few aliases that have helped me streamline my workflow and be all around more productive. After all, the whole point of shortcuts is to make your life easier right? I’d like to share my aliases with you, however unhelpful they may be.
Branching
co = checkout # Shortcut for checkout.
nb = checkout -b # Create a new branch and check it out.
bl = branch -l # List all local branches.
br = branch -r # List all remote branches.
blr = branch -a # Show local and remote branches.
bd = branch -d # Politely ask Git to delete a local branch.
bdf = branch -D # Sternly ask Git to delete a local branch.
Fetching/Syncing/Merging
fp = fetch -p # Fetch and prune.
sync = !git pull && git push # Pull then push current branch.
mm = !git fetch -p && git merge origin/master #Merge remote master into the current branch.
Commits
cm = commit # Shortcut for commit.
cma = commit -a # Commit all tracked.
cmam = commit -a -m # Commit all tracked with message to follow.
runAway = reset --hard # For when you just want it all to go away.
forgetAbout = rm --cached # Make Git forget about a tracked file.
Utilities
alias = config --get-regexp ^alias\\. # List all aliases.
ec = config --global -e # Open .gitconfig in your default editor.
I have all of these and maybe more by time you're reading this in a handy GitHub repo if you'd like to [include]
it in your Git config.
I hope these aliases are as useful for you as they are for me.
If you have your own favorite aliases, leave them in the comments below.
Top comments (4)
Nice. Here are a handful of my favorites (where we don't overlap):
The formats associated with above:
Nice. Here are my personal favorites:
gist.github.com/arnaudjuracek/3188...
I'm totally stealing some of these if you don't mind :)
I use the first 4 most days gist.github.com/cottsak/413c824d93...