git use command, in particular: git checkout -ba git branch a difference and

https://www.cnblogs.com/wuyifu/p/5867567.html

 

Excerpt:  https://my.oschina.net/u/587974/blog/74341

Creating a branch: $ git branch mybranch
switching branch: $ git checkout mybranch
create and switch branch: $ git checkout -b mybranch

Update things on the main line to the master branch: $ git rebase master

Switch to master branch: $ git checkout master

Update on what mybranch branch to the master: $ git rebase mybranch

Submit: git commit -a

On the last commit to make changes: git commit -a -amend

After commit, if you want to undo the most recent submission (ie return to a version) and local retention of code: git reset HEAD ^
merge branches: (Merge from) $ git Checkout Master
$ git Merge mybranch (Merge from mybranch)
deleted branches: $ git branch -d mybranch
force the removal of branch: $ git branch -D mybranch
list all branch: $ git branch
to view the various branches of the last commit: $ git branch -v

To see which branches merged into the current branch: $ git branch -merged

To see which branches are not merged into the current branch: $ git branch -no-merged

Update the remote to the local library: $ git fetch origin
Push branch: $ git push origin mybranch
take remote branch into local: $ git merge origin / mybranch
take remote branch and differentiate a new branch: $ git checkout -b mybranch origin / mybranch
delete remote branch: $ git push origin: mybranch

rebase: $ git checkout mybranch
$ git rebase master (rebase from master)

举例: $ git checkout server
$ git rebase –onto master server client
$ git checkout master
$ git merge client (fostforward)
$ git rebase master server (checkout sever)
$ git merge server
$ git branch -d client
$ git branch -d server

Guess you like

Origin www.cnblogs.com/itlover2013/p/11225423.html