Last active
June 19, 2023 17:21
-
-
Save ferreiratiago/5d907c7b44ca7990b899cdafaa7157a1 to your computer and use it in GitHub Desktop.
.gitconfig
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] | |
# list aliases | |
alias = "!git config -l | grep alias | cut -c 7-" | |
# one-line log | |
ls = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
# graph log | |
la = log --oneline --graph --decorate --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 | |
# list branches sorted by last modified | |
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'" | |
u = pull | |
a = add | |
aa = add . | |
cm = commit -m | |
d = diff | |
co = checkout | |
pp = push origin HEAD | |
# show the working tree status in short format | |
s = status -s | |
# force (-f) remove untracked files/directories (-d) from the working tree | |
cf = clean -f -d | |
unstage = reset HEAD -- | |
append = commit --amend --no-edit | |
lease = push --force-with-lease | |
# checkout a pull request | |
# usage: git pr <pull-request-id> | |
# example: git pr 123 | |
# note: you will need to have the remote upstream set up for this to work | |
# note2: this will create a new branch named pr/<pull-request-id> | |
pr = "!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment