Skip to content

Instantly share code, notes, and snippets.

@JujuDel
Last active April 21, 2023 09:01
Show Gist options
  • Save JujuDel/e48dbc020b442667826101a75b64266f to your computer and use it in GitHub Desktop.
Save JujuDel/e48dbc020b442667826101a75b64266f to your computer and use it in GitHub Desktop.
Some git aliases taken on other gists, or created/adapted
[user]
name = JujuDel
email = julien.delclos@gmail.com
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[alias]
say = "!f() { msg=${1-Hello World}; echo $msg; }; f"
st = status
diffc = diff --cached
cp = cherry-pick
us = submodule update --recursive --init --jobs=16
us1 = submodule sync --recursive
us2 = submodule update --recursive --init
fetchall = fetch --all -t -p --recurse-submodules --jobs=16
DoomClean = "!f() { git clean -dffx; git submodule foreach --recursive git clean -dffx; echo; git status;}; f"
DoomResetHead = "!f() { git reset HEAD --hard; git submodule foreach --recursive git reset HEAD --hard; echo; git status;}; f"
DoomPurge = "!f() { git DoomClean; git DoomResetHead; git us; echo; echo; git status;}; f"
# pretty:
# %Creset : reset color
# %C(...) : color specification
# %h : commit hash
# %s : commit subject
# %d : ref name
# %cr: commit date, relative
# %an: commit author
h = log --graph --all --pretty=format:'%C(auto)%h%d%Creset - %C(white bold)%s%Creset (from %C(green bold)<%an>%Creset %cr)' --abbrev-commit
hist = h
# Undo last commit but keep changed files in stage
uncommit = reset --soft HEAD~1
# Remove file(s) from Git but not from disk
untrack = rm --cache --
# Useful when you have to update your last commit
# with staged files without editing the commit message.
oops = commit --amend --no-edit
# stash aliases
slist = stash list
sapply = !sh -c \"git stash apply stash@{$1}\" -
sdrop = !sh -c \"git stash drop stash@{$1}\" -
sdiff = !sh -c \"git stash show stash@{$1}\" -
sdiffp = !sh -c \"git stash show -p stash@{$1}\" -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment