[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
查看本地分支信息
$ git branch
* master
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
查看分支最后一次提交信息
$ git branch -v
* master 1c4ed79 #AHB-20 add get device subdevice list
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
创建本地分支
$ git branch test-protocol
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
查看本地分支信息
$ git branch
* master
test-protocol
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
查看远程分支信息
$ git branch -r
origin/HEAD -> origin/master
origin/master
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
#查看所有的分支信息
$ git branch -a
* master
test-protocol
remotes/origin/HEAD -> origin/master
remotes/origin/master
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
#切换到本地test-protocol分支
$ git checkout -b test-protocal
Switched to a new branch ‘test-protocal‘
[email protected] MINGW64 ~/WebstormProjects/backEndServer (test-protocal)
# 查看分支信息
$ git branch -a
master
* test-protocal
test-protocol
remotes/origin/HEAD -> origin/master
remotes/origin/master
[email protected] MINGW64 ~/WebstormProjects/backEndServer (test-protocal)
# 将本地test-protocol分支推送至远端
$ git push origin test-protocal:test-protocal
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for ‘test-protocal‘ on GitHub by visiting:
remote: https://github.com/13701761349/backEndServer/pull/new/test-protoca
remote:
To https://github.com/13701761349/backEndServer.git
* [new branch] test-protocal -> test-protocal
[email protected] MINGW64 ~/WebstormProjects/backEndServer (test-protocal)
$ git branch -a
master
* test-protocal
test-protocol
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/test-protocal
[email protected] MINGW64 ~/WebstormProjects/backEndServer (test-protocal)
$
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
$ git branch -r
origin/HEAD -> origin/master
origin/master
origin/test-protocal
[email protected] MINGW64 ~/WebstormProjects/backEndServer (master)
#拉取远程分支版本
#git checkout -b 本地分支名 origin/远程分支名
$ git checkout -b test-protocal origin/test-protocal
Switched to a new branch ‘test-protocal‘
Branch ‘test-protocal‘ set up to track remote branch ‘test-protocal‘ from ‘origin‘.
原文地址:https://www.cnblogs.com/lianghong881018/p/11612398.html