简体   繁体   English

Git和分支机构

[英]Git and branches

ok so apparently to create a new git branch on the remote repository we need: 好吧,显然要在我们需要的远程存储库上创建一个新的git分支:

git push origin origin:refs/heads/sandbox
git fetch origin
git checkout --track -b sandbox origin/sandbox
git pull

Now if I want to switch back to the master branch I can just do 现在,如果我想切换回主分支,我可以做

git checkout master git checkout master

If I want to switch back to sandbox after going back to master, do I need 如果我想在回到主人后切换回沙箱,我是否需要

git checkout --track -b sandbox origin/sandbox git checkout --track -b sandbox origin / sandbox

or just 要不就

git checkout sandbox git checkout沙箱

git checkout sandbox will work. git checkout sandbox会起作用。 When you did the checkout -b sandbox origin/sandbox , you set up a local branch named sandbox which will track the remote origin/sandbox . 当您执行checkout -b sandbox origin/sandbox ,您将设置一个名为sandbox的本地分支,它将跟踪远程origin/sandbox To get the latest changes from upstream into your local copy, do git pull when on the sandbox branch. 要从上游获取最新的更改到本地副本,请在sandbox分支上执行git pull

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM