Skip to content

Instantly share code, notes, and snippets.

@adrianokerber
Last active July 14, 2022 03:57
Show Gist options
  • Save adrianokerber/35ba32a05d7e9f46c3e1dbf0adc1528f to your computer and use it in GitHub Desktop.
Save adrianokerber/35ba32a05d7e9f46c3e1dbf0adc1528f to your computer and use it in GitHub Desktop.
Git - ˜/.gitconfig
[alias]
# Fetch all and prune branches
fp = fetch -p
fap = fetch --all -p
## ASSUME UNCHANGED: warning - to checkout to another commit remember to call *git update-index --no-assume-unchange <file>* to keep track of the file again
# List all files assumed as unchanged
ignored = !git ls-files -v | grep "^[[:lower:]]"
# Assume file unchanged
ignore = "!f() { git update-index --assume-unchanged \"$1\" \"$1\"; }; f"
# Keep track again...
ignore-not = "!f() { git update-index --no-assume-unchanged \"$1\" \"$1\"; }; f"
# Update all submodules (This alias avoids the need from your interaction with each submodule doing git pull manually ;))
su = submodule foreach git pull
# List each submodule branch name (To be certaing of the workingspace)
su-list = submodule foreach git branch -al
# Get current branch name
branchname = !"git branch | grep \\* | cut -d ' ' -f2-"
# Diff without markers
diff-raw = !"git diff --color | sed -r \"s/^([^-+ ]*)[-+ ]/\\1/\" | less -r"
# Diff showing changed folders
diff-by-folders = !git diff --dirstat=files,0 HEAD~1 | sed 's/^[ 0-9.]\\+% //g'
# Logs
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = 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(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = 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 cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
[user]
name = Adriano Kerber
email = kerberpro@gmail.com
signingkey = 1223E96D7F319317
[commit]
gpgsign = true
[tag]
gpgSign = true
[core]
autocrlf = true
editor = vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment