sudo apt-get install git bash-completion


git config --global "Themewerk"
git config --global "[email protected]" git config --global credential.helper "cache --timeout=3600" git config --global color.branch auto git config --global color.diff auto git config --global color.interactive auto git config --global color.status auto git config --global core.safecrlf true git config --global core.autocrlf input # on unix like os git config --global core.autocrlf true # on windows (not needed with new client) git config --global core.excludesfile ~/Dropbox/Public/gitignore_global.txt 

Stage deleted files

git add -u

Remove submodule

Delete submodule from .gitmodules, .git/config, .git/modules/[path to module]


git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short

Git aliases

In ~/.gitconfig

    co = checkout
    ci = commit
    st = status
    br = branch
    hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short

In ~/.bash_aliases

alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'

alias got='git '
alias get='git '

Revert local unstaged changes

git checkout hello.html

Unstage staged changes

git reset HEAD hello.html

Changes will be still here, to revert them use

git checkout hello.html

Revert last commit

git revert HEAD --no-edit

This will revert last commit, but commit will still be in history

Revert and remove commits

git reset --hard v1 #or hash

Change previous commit

git add hello.html
git commit --amend -m 'msg'

Create branch and switch to it

git checkout -b style

Merge brachens

git checkout [branch to update]
git merge [branch to update from]

If there is conflicts while mergin – just fix and commit them

To list available local branches use:

git branch

And to list available remote branches use:

git branch -a

Add remote branch

git branch --track [local branch name] origin/[remote branch name]

Delete branch

git branch -D gh-pages # deletes local branch
git push origin --delete gh-pages # deletes remote branch


git remote
git remote show origin


To ignore dirty changes add ignore = dirty to problematic submodule in youd .gitmodules file