Git分支操作
情景:两台机器公用一个账户同步操作。
1. PC1本地分支push到远端
git co -b local-br-name
some changes
commit
git push remote-name(origin) local-br-name:remote-br-name(if remote is omitted, same as local will be applied)
2. PC2获取远端分支
git co -b local-br-name remote-name/remote-br-name
some changes
commit
git push(master br on local/remote will not change)
3. PC1获取更新
git pull remote-name(origin) remote-br-name
如果使用git pull错误的merge了远端分支到local分支上,使用git reset HEAD^放弃修改(commit log里面也一并删除)