git branch create and submit to a remote branch

git branch create and submit to a remote branch

https://www.cnblogs.com/bluestorm/p/6252900.html

git branch (using a branch command
http://hbiao68.iteye.com/blog/2055493

 

0. You can view the distal bifurcation library by git branch -r command

 

1, create a new branch from an existing branch (such as from the master branch), create a dev branch

git checkout -b dev

2, you can create a finished look, the branch has been switched to dev

git branch

    * dev

    master

3. establishing a local upstream (distal end) of the cartridge link - up so that the code can be submitted

git branch --set-upstream-to=origin/dev 

Cancel the master track

git branch --unset-upstream master

 

Create a remote branch git branch submitted - oppotvr
https://my.oschina.net/u/219482/blog/285584

 

The following two should be the same meaning, = upstream: mean stream upstream
Git Branch upstream-to-the --set = Master
Git Branch upstream-to-the --set = Original / Master


git help branch
git branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
git branch --unset-upstream [<branchname>]

Branch --set-upstream-git to = Original / Master new new
git Branch --set-upstream Origin debug / debug // where debug is created branch

 

The branch submitted to the remote repository
git push origin dev


The difference between git push origin and git push -u origin master of

 

$ git push origin

Represents the above command, the current branch corresponds to the branch origin push host. 

If the current track has only one branch branch, then the host name can be omitted. 

$ Git push If the current relationship between the branch and the presence of trace multiple hosts, then this time -u option to specify a default host so that you can later use without any parameters git push.

$ Git push -u origin master above command will be pushed to the master branch origin host, while designated as a default host origin, the latter can be used without any git push the parameters.


# Local branch code is submitted to the remote repository
git the Push Origin Master
git the Push the HEAD Origin: refs / for / remote branch name

git push origin local branch name: refs / for / remote branch name

EG:
Git Push test Origin: refs / for / master test # local branch code submitted to the distal end of the master library


New branch in a remote server:

method 1:

Checkout -b dev Git
# establishing a local link to the upstream (distal end) of the cartridge - such a code to submit up
Git Branch the --set upstream-to-Origin = / dev 
Git Branch the --set-upstream Origin Debug / Debug // where debug is created branch
git push origin dev

# Cancel tracking master's
git branch --unset-upstream master

 

Method 2:

Branch stage2 -b git
git the Push Origin local branch name: remote branch name xx // Create a new branch in the server name xxx

 

Compared:

Branch -b STAG2 Git
Git Push stage2 Origin: refs / for / stage2 // storage command codes, a new branch at the distal end is not new

Guess you like

Origin blog.csdn.net/songxiugongwang/article/details/86750522