Git

doc

 * http://gitref.org/ - git simple doc
 * https://www.atlassian.com/git/tutorials/setting-up-a-repository - git tutorial from stlassian

gitlab create new project
git config --global user.name "Yufei Ren" git config --global user.email "yufei.ren@thomsonreuters.com"
 * git global setup

check git config
git config --list

ssh-keygen
>ssh-keygen -t rsa -C "email@address"

git change origin url
git remote set-url origin new_git_url

For ssh protocol (eg: git@github.com:ReutersMedia/logprocnode.git)
Add below two lines to your ~/.ssh/config HOST github.com ProxyCommand ssh distuser@10.90.39.170 "nc %h %p"

For http,https protocol (eg: https://github.com/mochi/mochiweb.git )
Run below command to add corresponding configs to ~/.gitconfig. $ git config --global http.proxy http://10.90.7.56:3128/

For git protocol (eg: git://github.com/mochi/mochiweb.git)
Create /usr/local/bin/gitproxy.cmd with below content: ssh distuser@10.90.39.170 "nc $1 $2" And make it executable: $ sudo chmod a+x /usr/local/bin/gitproxy.cmd Then run below command to add corresponding configs to ~/.gitconfig. $ git config --global core.gitproxy /usr/local/bin/gitproxy.cmd
 * 1) !/bin/sh

find in which tag
>git describe --tags >git describe --all

git tutorials

 * https://www.atlassian.com/git/tutorials - git tutorials from atlassian

git revert change
git reset --hard
 * https://www.atlassian.com/git/tutorials/undoing-changes

git checkout rev_no.
 * revert code to previous commit

git submodule

 * http://git-scm.com/book/en/v2/Git-Tools-Submodules

github synchronize a fork
eg: >git clone git@github.com:yren/DiscoverMeteor_zh.git >cd DiscoverMeteor_zh lokvins-MBP:DiscoverMeteor_zh lokvin$ git remote -v origin	git@github.com:yren/DiscoverMeteor_zh.git (fetch) origin	git@github.com:yren/DiscoverMeteor_zh.git (push) >git remote add upstream git@github.com:DiscoverMeteor/DiscoverMeteor_zh.git >git fetch upstream >git checkout master >git merge >git merge upstream/master
 * https://help.github.com/articles/fork-a-repo/ - fork a repo
 * https://help.github.com/articles/syncing-a-fork/ - syncing a fork

github pages

 * https://pages.github.com/

git branch
git branch -u origin/master master
 * set upstream branch

git remote update --prune
 * update remote branch

git branch new_branch_name
 * create a new branch

git checkout -b new_branch_name git checkout -b ckb-1 origin/ckb-1
 * git checkout -b branch
 * 1) create branch ckb-1 base on origin/ckb-1

equals

git branch new_branch_name git checkout new_branch_name

list remote branch $ git branch -r origin/CKB-11783 origin/CKB-11837 origin/HEAD -> origin/master origin/betausS3 origin/dbchanges origin/master origin/sampleBETAUSconfig
 * git branch -r

list local branch
 * git branch -l [--list]

git push origin --delete  git push origin :
 * delete remote branch
 * 1) after git v.1.7
 * 1) before v1.7

* master
 * git branch -l

untrack file
git rm --cached .project
 * add file to .gitignore
 * git rm --cached

git update-index --assume-unchanged [path] git update-index --no-assume-unchanged [path]
 * or use

git log graph
git log --graph --all --oneline

git rebase
git rebase -i master git rebase -i ^head
 * 1) clean local commit
 * 1) Do not do rebase on public branch


 * https://www.atlassian.com/git/tutorials/merging-vs-rebasing