Skip to content

Instantly share code, notes, and snippets.

@atifaziz
Last active May 5, 2023 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atifaziz/6a8cd916aadee8e5867446762117ee66 to your computer and use it in GitHub Desktop.
Save atifaziz/6a8cd916aadee8e5867446762117ee66 to your computer and use it in GitHub Desktop.
My Git aliases
[alias]
aliases = config --get-regexp ^alias\\.
last = log -1 HEAD
ls = log --decorate --pretty=format:%Cgreen%h%Cred%d%Creset\\ %s\\ [%an]
ll = log --pretty=fuller
st = status
diffc = diff --cached
ci = commit
cia = commit --amend
mff = merge --ff-only
mt = mergetool
co = checkout
ciax = commit --amend --no-edit
pullf = pull --ff-only
hide = update-index --assume-unchanged
unhide = update-index --no-assume-unchanged
cloneb = clone --single-branch -b
clone-master = clone --single-branch -b master
addx = add --chmod +x
cleanc = clean -f *.orig
save = stash
savek = stash -k
pop = stash pop
nuke = reset --hard
ec = config -e
ecg = config --global -e
branch-name = rev-parse --abbrev-ref HEAD
branch-up = rev-parse --abbrev-ref 'HEAD@{upstream}'
publish = !git push -u origin $(git branch-name)
rbc = rebase --continue
au = add -u
fwd = !sh -c 'git checkout $(git rev-list --topo-order HEAD..$1 | tail -1)' -
bgrep = !sh -c 'git branch --format %\\(refname:lstrip=2\\) | grep -F $1' -
colike = !sh -c 'git checkout $(git bgrep $1 | head -1)' -
fplog = !sh -c 'git log $(git merge-base --fork-point $1)..HEAD' -
fpls = !sh -c 'git ls $(git merge-base --fork-point $1)..HEAD' -
fa = fetch --all
fap = fetch --all -p
where-was-i = !sh -c 'git rev-parse --abbrev-ref $(git log -g --decorate=full --pretty=%d | grep -P \\\\x28 | tr , \\\\n | tr -d \\\\40\\\\50\\\\51 | grep -vE ^HEAD | grep -vE ^refs/remotes/ | head -1)' -
wwi = where-was-i
x-return = !sh -c 'b=$(git branch-name) && git checkout $(git where-was-i) && git branch -d $b' -
fb = !sh -c 'git fetch $1 $2 && git checkout -b $2 FETCH_HEAD' -
fm = !sh -c 'git fetch $1 $2 && git merge --ff-only FETCH_HEAD' -
sync = !sh -c 'git checkout --quiet HEAD; git fetch $1 $2:$2; git checkout --quiet -'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment