Created
May 24, 2022 20:20
-
-
Save brianwhited/675527d4626468fcef014f0f729113eb to your computer and use it in GitHub Desktop.
This file contains 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] | |
#https://git.wiki.kernel.org/index.php/Aliases | |
#https://opensource.com/article/20/11/git-aliases | |
#https://git-scm.com/book/en/v2/Appendix-C:-Git-Commands-Setup-and-Config | |
# Stage all modified, new, or deleted files | |
addall = !git add -A | |
ar = remote -v | |
alias = "!sh -c '[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1' -" | |
# List all aliases | |
aliases = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ / | |
br = branch | |
# Changes | |
changes = diff --name-status -r | |
# Commit | |
ci = commit | |
# Commit with message | |
cm = commit -m | |
cmt = commit -m | |
# Cherry Pick | |
cp = cherry-pick | |
# Checkout | |
co = checkout | |
# Conflicts | |
gitkconflict = !gitk --left-right HEAD...MERGE_HEAD | |
gitconflicts = !gitk --left-right HEAD...MERGE_HEAD | |
# Delete local branch | |
dlb = branch -d | |
deletelocalbranch = branch -d | |
# Differences | |
diffstat = diff --stat -r | |
differences = diff --stat -r | |
f = fetch | |
# Force delete local branch | |
fdlb = branch -D | |
forcedeletelocalbranch = branch -D | |
# Shows details about the most recent commit made | |
last = log -1 HEAD --stat | |
# List all new commits after fetching, with stats, but excluding merges: | |
lc = log ORIG_HEAD.. --stat --no-merges | |
lol = log --graph --decorate --pretty=oneline --abbrev-commit --date=local | |
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
# List local branches | |
llb = branch | |
# Display your commits as single lines for more compact output | |
ll = log --oneline | |
ls = ls-files | |
# Merge | |
mr = merge | |
mrg = merge | |
# Merge to dev branch | |
#mrd = !git merge dev | |
# Merge to qa branch | |
#mrq = !git merge qa | |
# Merge to master branch | |
mrm = !git merge master | |
# My Config Files | |
myglobalconfigfile=!git config --global --edit | |
mylocalconfigfile=!git config --local --edit | |
# What new commits have been created by the last command (typically after a "git pull") : | |
new = !sh -c 'git log $1@{1}..$1@{0} "$@"' | |
pl = pull | |
po = push origin | |
ps = push | |
# Status | |
st = status | |
sts = status | |
# Show a UI | |
ui = !gitk | |
# Undo the last commit; will change head only. No change to index, working directory. | |
undo = reset --soft HEAD^ | |
# Will change head, index and working directory; Hard Reset | |
unfuck = reset --hard | |
# Similar to undo | |
unstage = reset HEAD -- | |
who = shortlog -s -- | |
# Takes the name of a person or their email address | |
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" | |
# Takes a commit name | |
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment