Skip to content

Instantly share code, notes, and snippets.

@stunko
Last active December 27, 2015 03:49
Show Gist options
  • Save stunko/7262870 to your computer and use it in GitHub Desktop.
Save stunko/7262870 to your computer and use it in GitHub Desktop.
.gitconfig aliases samples
[alias]
st = status
br = branch
chp = cherry-pick
cht = checkout
#Push tag's to remote repo. Example pushtag origin
pushtag = !sh -c 'git push $1 --tags' -
#Fetch tag's from remote repo. Example fetchtag origin
fetchtag = !sh -c 'git fetch $1 --tags' -
#Show git log as colored graph. Example git hist
hist = log --graph --pretty=format:'%Cred%h%Creset %Cgreen[%ad]%Creset %C(yellow)%d%Creset%s %C(bold blue)<%an>%Creset' --abbrev-commit --date=local
#Show git log as colored graph by commit author. Example git ha Eugeny Kurkovich , or git ha part author name
ha = !sh -c 'git log --graph --pretty=\"format:%Cred%h%Creset %Cgreen[%ad]%Creset %C(yellow)%d%Creset%s %C(bold blue)<%an>%Creset\" --abbrev-commit --date=local --author=\"$1\"' -
#Show short SHA1 commits by mask of commit text in the format used by the command git cherry-pick Example: git fc SCALARIZR-1191 or git fc SCALARIZR-1191 bqarnch name or git fc 'some text' bqarnch name
#Linux version
fc = !sh -c 'git log --pretty=\"format:%h "\n"\" --abbrev-commit --grep=\"$1\" $2 | tac -b -s \"\n\" | tr \"\n\" \" \" | xargs echo' -
#MacOS version
fc = !sh -c 'git log --pretty=\"format:%h "\n"\" --abbrev-commit --grep=\"$1\" $2 | tail -r | tr \"\n\" \" \"| xargs echo' -
#Show short SHA1 commits by mask of commit text in the format used by the command git revert Example: git frc SCALARIZR-1191 or git frc SCALARIZR-1191 bqarnch name or git frc 'some text' bqarnch name
frc = !sh -c 'git log --pretty=\"format:%h "\n"\" --abbrev-commit --grep=\"$1\" $2 | tr \"\n\" \" \" | xargs echo' -
#Shows the difference as short SHA1 commits betwenn two branches. Example: git dfc branch1 branch2 or git dfc branch1 HEAD or git dfc HEAD branch1
dfc = !sh -c 'git log --pretty=\"format:%h "\n"\" --abbrev-commit $1..$2 | tac -b -s \"\n\" | tr \"\n\" \" \" | xargs echo' -
[color]
ui = auto
[color "branch"]
current = white
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = FirstName LastName
email = user@email.com
[credential]
helper = cache --timeout=3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment