User Tools

Site Tools


git

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git [2017/08/31 14:16]
frank
git [2017/08/31 15:23] (current)
frank
Line 53: Line 53:
  
 === branch and tag === === branch and tag ===
-</code> +<​code>​ 
- # list tags<​code>​+ # list tags
  $ git tag -n  $ git tag -n
  # list local branches  # list local branches
Line 64: Line 64:
  # create a new branch, but do not switch to the branch  # create a new branch, but do not switch to the branch
  $ git branch [branch]  $ git branch [branch]
- # create a branch ​from a branch or tag and switch to this branch ?+ # create a branch and switch to it
  $ git checkout -b [branch] ​  $ git checkout -b [branch] ​
  # create a new branch and track remote branch  # create a new branch and track remote branch
- $ git branch --track [branch] [remote-branch]  + $ git branch --track [branch] [remote-branch] 
- track remote branch ​for existing ​branch + $ git checkout -b [branch] --track [remote-branch]  or git checkout -b [branch] [remote-branch] //tracking is by default 
- $ git branch --set-upstream-to [branch] [remote-branch]+ # track current branch to remote ​branch 
 + $ git branch --set-upstream-to ​ [remote-branch] 
 + # track a branch to remote branch 
 + $ git branch --set-upstream-to ​[remote-branch] [branch]
  # merge a branch to current branch  # merge a branch to current branch
  $ git merge [branch] ​  $ git merge [branch] ​
git.1504214185.txt.gz · Last modified: 2017/08/31 14:16 by frank