git checkout @~1
git show <commit-sha>
git push origin master
git branch -a
git branch -r
git remote update
git checkout -t -b <local-name> <remote-name>
git checkout -b <name>
git push origin <remote-name>
git checkout <target>
git merge <source>
git checkout <target>
git merge --squash <source>
git branch -r --merged master
https://help.github.com/articles/ignoring-files
pull changes from the server + rebase (equivalent of git stash save && git pull && git stash pop && git push) + push
git pull --rebase && git push
git daemon --base-path /home/git --verbose
git remote add origin <url>
git config --add branch.master.remote origin
git config --add branch.master.merge refs/heads/master
git diff --patch-with-raw rev1 rev2 patched_file > diff_file
GIT_PAGER='less -r' git dc
git apply diff_file
git push origin <name>
git push origin :<name>
git cherry-pick -n <sha>
git revert -n <sha>
git reset --hard HEAD~<n>
git rebase --interactive --autosquash HEAD~N
git log -S “free text”
git filter-branch --index-filter 'git rm --cached --ignore-unmatch <path to file>' --prune-empty --tag-name-filter cat -- --all
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git gc
git gc --aggressive
git prune
git fetch origin pull/1234/head:local-branch-name
git rev-parse --short <sha>
git config --global alias.aa "add --all"
git config --global alias.ai "add --interactive"
git config --global alias.b "branch"
git config --global alias.ba "branch -a"
git config --global alias.c "commit"
git config --global alias.ca "commit --amend"
git config --global alias.cf '!sh -c "git commit --fixup $@"'
git config --global alias.co "checkout"
git config --global alias.col '!sh -c "git checkout -b $@"'
git config --global alias.cor '!sh -c "git checkout --track -b $@ origin/$@"'
git config --global alias.cp "cherry-pick"
git config --global alias.cpa "cherry-pick --abort"
git config --global alias.cpc "cherry-pick --continue"
git config --global alias.cs '!sh -c "git commit --squash $@"'
git config --global alias.d "diff"
git config --global alias.dc "diff --cached"
git config --global alias.ds "diff --stat"
git config --global alias.dsc "diff --stat --cached"
git config --global alias.fpr '!sh -c "git fetch origin pull/$@/head:$@-pr"'
git config --global alias.l "log"
git config --global alias.lf "log --follow"
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --all"
git config --global alias.m "merge"
git config --global alias.mb "merge-base master HEAD"
git config --global alias.ms "merge --squash"
git config --global alias.pl "pull"
git config --global alias.ps "push"
git config --global alias.psc '!sh -c "git push --set-upstream origin \$(git rev-parse --abbrev-ref HEAD)"'
git config --global alias.psd '!sh -c "git push origin :\$(git rev-parse --abbrev-ref HEAD)"'
git config --global alias.r "reset HEAD"
git config --global alias.rb "rebase"
git config --global alias.rba "rebase --abort"
git config --global alias.rbc "rebase --continue"
git config --global alias.rbi "rebase --interactive --autosquash"
git config --global alias.rbm "rebase --interactive --autosquash origin/master"
git config --global alias.rh "reset --hard"
git config --global alias.rs "reset --soft"
git config --global alias.s "status"
git config --global alias.sh "show"
git config --global alias.shs "show --stat"
git config --global alias.st "stash"
git config --global core.excludesfile ~/.gitignore
git config --global user.name "Jakub Pawlowicz"
git config --global user.email '<email>'
git config user.name "Jakub Pawlowicz"
git config user.email '<email>'
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\u@\h \[\033[0;36m\]\w \[\033[0;32m\]$(parse_git_branch)\[\033[0m\]$ '