andreas-groos
1/1/2019 - 4:19 PM

[zsh git cheatsheat] shortcuts #git #cheatsheet

[zsh git cheatsheat] shortcuts #git #cheatsheet

AliasCommand
aliaslist all aliases
..cd ..
...cd ../..
....cd ../../..
.....cd ../../../..
/cd /
~cd ~
cd +nswitch to directory number n
1cd -
2cd -2
3cd -3
4cd -4
5cd -5
6cd -6
7cd -7
8cd -8
9cd -9
mdmkdir -p
rdrmdir
ddirs -v (lists last used directories)

See ~/.oh-my-zsh/lib/directories.zsh

Alias

example:

alias -s rb=vim #opens ruby files in vim
# $ foo.rb 
# vim => foo.rb
alias -g gp='| grep -i' #creates a global alias for grep
# $ ps ax gp ruby
# (all ruby process will be displayed)
FlagDescription
Lprint each alias in the form of calls to alias
glist or define global aliases
mprint aliases matching specified pattern
rlist or define regular aliases
slist or define suffix aliases

Tab-completion

For options and helpful text of what they do
ls -(tab)
cap (tab)
rake (tab)
ssh (tab)
sudo umount (tab)
kill (tab)
unrar (tab)

Git

Dynamic access to current branch name with the current_branch function
git pull origin $(current_branch)
grb publish $(current_branch) origin
AliasCommand
ggit
gagit add
gaugit add -u
gaagit add --all
gapagit add --patch
gbgit branch
gbagit branch -a
gbdgit branch -d
gblgit blame -b -w
gbnmgit branch --no-merged
gbrgit branch --remote
gbsgit bisect
gbsbgit bisect bad
gbsggit bisect good
gbsrgit bisect reset
gbssgit bisect start
gcgit commit -v
gc!git commit -v --amend
gcagit commit -v -a
gca!git commit -v -a --amend
gcan!git commit -v -a --no-edit --amend
gcans!git commit -v -a -s --no-edit --amend
gcamgit commit -a -m
gcsmgit commit -s -m
gcbgit checkout -b
gcfgit config --list
gclgit clone --recursive
gcleangit clean -fd
gpristinegit reset --hard && git clean -dfx
gcmgit checkout master
gcdgit checkout develop
gcmsggit commit -m
gcogit checkout
gcountgit shortlog -sn
gcpgit cherry-pick
gcpagit cherry-pick --abort
gcpcgit cherry-pick --continue
gcsgit commit -S
gdgit diff
gdcagit diff --cached
gdctgit describe --tags `git rev-list --tags --max-count=1`
gdtgit diff-tree --no-commit-id --name-only -r
gdwgit diff --word-diff
gfgit fetch
gfagit fetch --all --prune
gfogit fetch origin
gggit gui citool
ggagit gui citool --amend
ggpnpgit pull origin $(current_branch) && git push origin $(current_branch)
ggpullgit pull origin $(current_branch)
gglgit pull origin $(current_branch)
ggpurgit pull --rebase origin $(current_branch)
glumgit pull upstream master
ggpushgit push origin $(current_branch)
ggpgit push origin $(current_branch)
ggflgit push --force-with-lease origin <your_argument>/$(current_branch)
ggsupgit branch --set-upstream-to=origin/$(current_branch)
gpsupgit push --set-upstream origin $(current_branch)
gignoregit update-index --assume-unchanged
gignoredgit ls-files -v | grep "^[[:lower:]]"
git-svn-dcommit-pushgit svn dcommit && git push github master:svntrunk
gkgitk --all --branches
glgit pull
glggit log --stat --max-count = 10
glgggit log --graph --max-count = 10
glggagit log --graph --decorate --all
glogit log --oneline --decorate --color
gloggit log --oneline --decorate --color --graph
glp_git_log_prettily (git log --pretty=$1)
gmgit merge
gmtgit mergetool --no-prompt
gpgit push
gpoatgit push origin --all && git push origin --tags
grgit remote
grbgit rebase
grbagit rebase --abort
grbcgit rebase --continue
grbsgit rebase --skip
grbigit rebase -i
grhgit reset HEAD
grhhgit reset HEAD --hard
grmvgit remote rename
grrmgit remote remove
grsetgit remote set-url
grtcd $(git rev-parse --show-toplevel || echo ".")
grupgit remote update
grvgit remote -v
gsdgit svn dcommit
gspsgit show --pretty = short --show-signature
gsrgit svn rebase
gssgit status -s
gstgit status
gstagit stash save
gstaagit stash apply
gstdgit stash drop
gstlgit stash list
gstpgit stash pop
gstsgit stash show --text
gsugit submodule update
gtsgit tag -s
gunignoregit update-index --no-assume-unchanged
gunwipgit log -n 1 | grep -q -c "--wip--" && git reset HEAD~1
gupgit pull --rebase
gvtgit verify-tag
gwchgit whatchanged -p --abbrev-commit --pretty = medium
gwipgit add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"