You know that command that you have to Google every time you need it, or those sequential commands that repeat themselves several times during your day?
You can create an alias to make your life easier and use those extra seconds you will save to share this tip with your colleagues! Win-win situation! ๐
git config --global alias.<alias> '<command>'
For instance, by setting up this alias:
git config --global alias.undo '!git reset --soft HEAD~1'
To undo your last commit you just type:
git undo
Cool, right? You can also combine commands like this:
git config --global alias.shipit '!git add -A && git commit -m'
Now to stage all my files and comitt I just type:
git shipit 'message so relevant that my mother would be proud'
Do you already use aliases in your daily life? Share it in the comments so I can copy it and avoid fatigue!
ps: Did you noticed my custom octocat? Check out the awesome artwork by Zilart
๐
Top comments (4)
Here's my list. I might take some of yours as well ๐
One I really appreciate is git ul
Use that everytime I create a new branch and want to upstream it.
[alias]
st = status
ci = commit
cm = commit -m
co = checkout
cp = cherry-pick
br = branch
pr = pull --rebase
develop = checkout develop
master = checkout master
last = log -1 HEAD
unstage = reset HEAD --
staged = diff --cached
prp = !git pull --rebase && git push
ul = push -u origin HEAD
loll = log --graph --decorate --pretty=oneline
Thanks for sharing, Lars!
Your 'git ul' just entered my list of aliases ๐
Umm, GitHub isn't Git, sir.
you're absolutely right