Last active
July 6, 2022 14:58
-
-
Save kuvaldini/56ab6c2a1cf88745cc55b797099cf809 to your computer and use it in GitHub Desktop.
Useful aliases for Git
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] | |
sta = status | |
bra = branch | |
co = checkout | |
cos = checkout --recurse-submodule | |
cosf = checkout --recurse-submodule --force | |
root = rev-parse --show-toplevel | |
toplevel = rev-parse --show-toplevel | |
current-branch = rev-parse --abbrev-ref HEAD | |
sub = submodule | |
sup = submodule update | |
## Push to all remotes | |
pushar = !git remote | xargs -I {} git push {} | |
## Push from remote to remote, ref must already be fetched | |
remote2remote = "!sh -c \"git push $2 refs/remotes/$1/*:refs/heads/*\"" | |
update-branch = "!sh -c \"git update-ref refs/heads/$1 refs/remotes/origin/$1\"" | |
remove-gone = "!env LANG=en_US git branch -vv | awk '/^[^*].*: gone]/{print $1}' | xargs git bra -d " | |
## Fetch pull-request from GitHub | |
fetch-pr = "! f(){ rem=$1;shift; n=$1;shift; git fetch -u $rem pull/$n/head:pr/$n pull/$n/merge:pr/merge/$n "$@"; }; f" | |
fetcho = fetch origin | |
## Pull pull-request from GitHub, i.e. fetch+merge | |
pull-pr = "! f(){ rem=$1;shift; n=$1;shift; git pull --rebase=false $rem pull/$n/head "$@"; }; f" | |
## REQUIRED Git 2.21 (Q1 2019) | |
nicelog = log --decorate --graph --oneline -11 | |
l = log --graph --decorate --date=human --pretty=format:'%C(yellow bold)%h %C(green dim)%ad %C(blue)%an <%ae> %C(auto)%d %GS %n%w(0,3,3)%s%n%+b' | |
ll = log --graph --decorate --date=human --pretty=format:'%C(yellow bold)%H %C(auto)%d %GS %n%C(white dim)author: %C(green dim)%ai %C(blue)%an <%ae> %C(green)%ad %n%C(white dim)commiter: %C(green dim)%ci %C(blue)%cn <%ce> %C(green)%cd %n%w(0,3,3)%s%n%+b' | |
nl2 = log --graph --decorate --date=human --pretty=format:'%C(yellow bold)%h %C(green dim)%ad %C(blue)%an <%ae> %C(auto)%d %GS %n%w(0,3,3)%s' | |
nl = log --graph --decorate --date=human --pretty=format:'%C(yellow bold)%h %C(green dim)%ad %C(blue)%an %C(auto)%s %d' | |
## Third party | |
lc = log-compact --graph --decorate | |
fo = !git foresta --style=10 \"$@\" | less -RSX | |
fa = !git foresta --all --style=10 \"$@\" | less -RSX |
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
#!/usr/bin/env bash | |
curl https://gist.githubusercontent.com/kuvaldini/56ab6c2a1cf88745cc55b797099cf809/raw/5716a8363a49818181221546dd343c987951c211/.alias.gitconfig >~/.alias.gitconfig | |
git config --global include.path '~/.alias.gitconfig' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment