Last active
August 20, 2021 22:04
-
-
Save facundovictor/7337ddb4f32fa333551a to your computer and use it in GitHub Desktop.
My own git shortcuts
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] | |
# Shortcuts | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
# Get info of a git object | |
type = cat-file -t | |
dump = cat-file -p | |
# Listing the History in a tree format | |
hist = log --pretty=format:'%h %ad | [%an] %s%d ' --graph --date=relative | |
# Lis a file history | |
fhist = log --decorate --follow -p -- | |
# For listing commits with details (Author, date, changes, etc). | |
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat | |
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
le = log --oneline --decorate | |
# For listing conflicts | |
ls-c = diff --name-only --diff-filter=U | |
ll-c = ls-files -u | |
# For comparing files | |
vdiff = difftool --tool=vimdiff | |
# For showing the differenes between the staged changes and the original files (HEAD) | |
sdiff = diff --staged | |
# For searching files that are tracked by git. | |
find = "! git ls-files | fzf" | |
# For changing the GIT_AUTHOR_DATE and GIT_COMMITER_DATE | |
chdate = "!git filter-branch --env-filter \"if [ \\$GIT_COMMIT = '$1' ]; then export GIT_AUTHOR_DATE='$2'; export GIT_COMMITTER_DATE='$2'; fi\" && rm -rf \"$(git rev-parse --git-dir)/refs/original/\"" | |
# For picking a stash | |
stash-pick = "! git stash list | fzf --reverse --height='50%' --color dark --preview=\"echo {1} | cut -d':' -f1 | xargs -I % git show -p --color %\" | cut -d':' -f1" | |
# For picking a file from stage | |
modified-file-pick = "! git status --porcelain | awk '{print $2;}' | fzf --reverse --height='50%' --color light --preview=\"git diff --color {}\"" | |
# Git add interactively | |
ap ="! git add -p $(git modified-file-pick)" | |
# Count commits | |
commit-count = "rev-list --count --since=\"$(date '+%a %b %d 00:00:00 %Y %z')\" --before=today HEAD" | |
# Recover cached from stage | |
fsck-recover = fsck --cache --no-reflogs --lost-found --dangling HEAD | |
[user] | |
name = Facundo Victor | |
email = [email protected] | |
[color] | |
ui = auto | |
[pull] | |
rebase = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment