Skip to content

Instantly share code, notes, and snippets.

@sni10
Forked from pvaviloff/Git aliases (.gitconfig)
Last active August 5, 2022 14:35
Show Gist options
  • Save sni10/24de321265a1d8f0b9747e9f51680daf to your computer and use it in GitHub Desktop.
Save sni10/24de321265a1d8f0b9747e9f51680daf to your computer and use it in GitHub Desktop.
[user]
name = Name Secondname
email = [email protected]
[alias]
st = "!git status -sbu --show-stash"
sti = "!git st --ignored"
br = "!git st; git branch --list --color"
bra = "!git st; git branch -a --list --color"
brr = "!git st; git br -r"
# git in / git out — смотреть какие коммиты придут/уйдут перед выполнением pull/push
in = "!git remote update -p; git log ..@{u}"
out = "!git log @{u}.."
up = !(git add . && git stash && git pull --rebase >&2) | grep -v \"No local changes to save\" && git stash pop
rh = "!git reset HEAD --hard"
[alias]
#checkout branches
master = "!git checkout master; git pull; git br"
test = "!git checkout test; git pull; git br"
ch = "!git checkout \"$@\"; git br"
chr = "!git switch -c \"$@\"; git br"
#short codes
pull = "!git pull; git br"
push = "!git push; git br"
pp = "!git pull; git push; git br"
mm = "!git merge master; git br"
mb = "!git pull; git merge \"$@\"; git br"
abort = "!git merge --abort"
#log showing changed files AND my log and changed files
lg = "!git log --pretty=format:\"%C(yellow)%h\\ %C(red)%ad%Cred%d\\ %C(cyan)%s\\ %C(blue)[%cn]\" --decorate --numstat --date=short"
lgme = "!git lg --author=d.strilets"
#short log
lgs = "!git log --pretty=format:\"%C(yellow)%h\\ %C(red)%ad%Cred%d\\ %C(cyan)%s\\ %C(blue)[%cn]\" --decorate --date=short"
lgsme = "!git lgs --author=d.strilets"
#show branches and commits
hist = "!git log --pretty=format:\"%C(magenta)%h %C(red)%ad | %C(cyan)%s%d %C(blue)[%an]\" --graph --date=short"
histme = "!git hist --author=d.strilets"
#create branch and checkout
new = "!git checkout -b \"$@\""
#drop branch
del = "!git branch -D"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
[color]
ui = true
[color "branch"]
current = cyan bold reverse
local = cyan bold
remote = red
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
header=cyan bold
added = green bold
changed = magenta bold
untracked = red bold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment