My git
aliases
I use the following aliases in git all the time.
Status Info
br = branch
Simple branch info. No muss, no fuss.
bra = branch -v
Branch info with just a little more muss & fuss.
st = status --ignore-submodules=dirty
Current status, excluding changes in those dirty little submodules.
Preparing for commit
unstage = reset HEAD --
Remove all, one or many files from staging.
co = checkout
- revert one or more files back to original state.
- move to another branch.
Log Viewing
lm = log master..
Show me commits on this branch that differ from master.
mt = mergetool
Bring up visual merge.
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(magenta)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
Show me the first line of each commit, with simple branch info & visualization.
lgm = log master.. --graph --pretty=format:'%Cred%h%Creset - %s' --abbrev-commit
Show me commits with first line of everything that’s changed since master.
Cleanup & Pushing
pom = push origin master
Horrible command, do not add this one. You’ll use it all the time. Even when you don’t intend to.
remas = rebase master
Rebase on master.
fixup = commit --amend --reuse-message HEAD
add
files to staging- update the last commit with them
/via @jeffxl
Pausing a Branch
wip = commit -a -m "WIP"
Checkin all current files and denote that the work contained there is not complete. Usefull when you want to move to a new branch, but not lose track of exactly where you were on the current branch.
See go
below for picking back up.
go = reset HEAD^
Pop off the latest commit on a branch and go back to working on it. Best when
used in conjunction with wip
[Alias] from ~/.gitconfig
[alias]
co = checkout
br = branch
bra = branch -v
st = status --ignore-submodules=dirty
unstage = reset HEAD --
lm = log master..
mt = mergetool
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(magenta)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lgm = log master.. --graph --pretty=format:'%Cred%h%Creset - %s' --abbrev-commit
pom = push origin master
remas = rebase master
fixup = commit --amend --reuse-message HEAD
wip = commit -a -m "WIP"
go = reset HEAD^