Created
January 4, 2022 16:35
-
-
Save NickCrew/c8ab79aa24e6d639950c9e10525f9f64 to your computer and use it in GitHub Desktop.
Git CLI Aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# Show git status | |
st = status | |
# Commit staged changes with editor | |
ct = commit | |
# Push to remote | |
pu = push | |
# Pull from remote | |
pl = pull | |
# Fetch remote data | |
fe = fetch | |
# Checkout branch | |
co = checkout | |
# Checkout new branch | |
cob = checkout -b | |
# Modify/add to last commit | |
amend = commit -a --amend | |
# revert last commit | |
undo = reset HEAD~1 --mixed | |
# revert added files | |
unstage = reset HEAD -- | |
# revert all modifications | |
revert = reset HEAD~1 --hard | |
# add and commit all changed files | |
cm = !git add -A && git commit -m | |
# Update including submodules | |
up = !git pull --rebase --prune $@ && git submodule update --init --recursive | |
# Total obliteration | |
wipe = !git add -A && git commit -qm WIPE SAVEPOINT && git reset HEAD~1 --hard | |
# | |
### Diff/Merge | |
dt = difftool | |
dtb = !"git difftool --tool bc4" | |
dtv = !"git difftool --tool vimdiff" | |
dtg = !"git difftool -g" | |
dtlast = !"git difftool HEAD@{1}" | |
# | |
### Log | |
lch = log -n 1 --pretty=format:'%H' | |
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
lg = !"git lg1" | |
# | |
### Misc | |
igsym = !find `git rev-parse --show-toplevel` -type l | sed -e s'/^\\.\\///g' >> "$(git rev-parse --show-toplevel)/.gitignore" | |
root = rev-parse --show-toplevel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment