git install on ubuntu
sudo apt-get install git
point your local repository to remote repository
git remote add origin git@....repo_url
set user config
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
set alias for git command
git config --global alias.co checkout
GUI tool
gitg (can install : sudo apt-get install gitg)
merge tool
apt-get install meld
configure merge tool
git config --global merge.tool meld
See uncommited changes diffrence
git difftool
Undo changes.
git checkout . - Removes Unstaged Tracked files ONLY
git clean -f - Removes Unstaged UnTracked files ONLY
git reset --hard - Removes Staged Tracked and UnStaged Tracked files ONLY
git stash -u - Removes all changes
save uncommited changes
git stash
git stash pop
git stash apply
append to previous commit
git commit --amend
Rebase (Read more about rebase)
git rebase -i branch
Rollback commit
git reset --soft HEAD^
git reset --hard HEAD^
git reset --hard HEAD^^
Restore commit
git reset --hard f6e5064
or
git reset HEAD@{1}
Reference log
git reflog show
Generate patch file
git format-patch HEAD~
git apply --stat fix_empty_poster.patch
git apply --check fix_empty_poster.patch
git am --signoff < fix_empty_poster.patch