User Tools

Site Tools


work:git-guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
work:git-guide [2015/03/05 07:52] – [git tag] percywork:git-guide [2016/11/04 16:55] percy
Line 384: Line 384:
 git push origin master git push origin master
 </code> </code>
 +
 +==== change url ====
 +  git remote set-url origin https://github.com/jikabao/merchantapp_android.git
  
 ==== create patch ==== ==== create patch ====
Line 435: Line 438:
 Then create new branch base on the current commitment Then create new branch base on the current commitment
   git branch newtagbranch   git branch newtagbranch
 +  
 +==== git fetch & git merge ====
 +
 +Refer to
 +  - http://www.ruanyifeng.com/blog/2014/06/git_remote.html
 +  - http://www.cnblogs.com/youxin/p/3470335.html
 +  - http://longair.net/blog/2009/04/16/git-fetch-and-merge/
 +
 +<code>
 +git checkout feature/sp_xd
 +git fetch origin feature/sp_xd:tmp
 +git diff tmp
 +git merge tmp
 +
 +git checkout feature/sp_xd
 +git fetch --all
 +git fetch origin feature/sp_xd
 +git diff feature/sp_xd origin/feature/sp_xd
 +git merge origin/feature/sp_xd
 +
 +git branch -D tmp
 +
 +git checkout feature/sp_xd
 +git fetch origin feature/sp_xd
 +git checkout -b newBrach origin/feature/sp_xd
 +
 +#Delete the local branch that already deleted from the remote
 +git remote prune origin
 +
 +#Remote server
 +git remote -v
 +
 +#Remote branch
 +git branch -r
 +#All branch
 +git branch -a
 +
 +#Show the remote repo information
 +git remote show origin
 +git remote prune origin
 +</code>
 +
 +==== git subtree ====
 +Refer to
 +http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/
 +<code bash>
 +git remote add -f datalayer   https://Jianqing.Peng@stash.englishtown.com/scm/mobile/datalayer-android.git 
 +git subtree add  --prefix=datalayer datalayer integration_lean --squash
 +git fetch all  --prune   
 +git fetch datalayer integration_lean
 +git subtree pull --prefix=datalayer/ datalayer integration_lean --squash
 +git subtree push --prefix=datalayer/ datalayer integration_lean
 +</code>
 +
 +
 +==== git checkout specified file from another branch ====
 +
 +  * http://stackoverflow.com/questions/2364147/how-to-get-just-one-file-from-another-branch
 +
 +  git checkout branch_name -- path/to/file
 +  
 +
/var/www/dokuwiki/wiki/data/pages/work/git-guide.txt · Last modified: 2018/02/05 19:15 by percy