Goal: Introduce shortcuts / tricks that make working with Git faster
Execute daily task (commit, pull, push, merge, etc) fast
Know what we are doing
Track changes easily, also find out who to ... blame
Solutions: colors, extra info, shorthand commands, simple behavior
Assuming you are using command-line git
~/.gitconfig
Global git settings is here
~/.bashrc
Additional helpers
Some other tools
gitk, kdiff3
Show current branches with color
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
. /etc/bash_completion.d/git-completion.bash;
fi
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]\$(__git_ps1 ' %s')\[\033[01;34m\] \$\[\033[00m\] "
export PS1="\[\033[G\]$PS1"
Source: https://www.quora.com/What-are-some-useful-bash_profile-and-bashrc-tips
[color]
ui = true
[diff]
tool = kidff3
[difftool]
prompt = false
[push]
default = simple
[alias]
s = status
cm = commit --message
tree = log --graph --pretty=oneline --abbrev-commit --decorate
adda = add --all
resolve = mergetool
dfa = diff -w
dfs = diff --cached
Create new branch: git checkout -b branch_name
check file status: git status
Commit your staged changes: git commit or git commit -m "Message"
Merge a feature branch back to master: git merge branch_name
Scenario: Mark work on mark/test. Then master is updated & he need to use the new code. He can either merge, or rebase.
Rebase: git rebase branch_to_rebase_on