[英]Cloning code from master branch to local repository
So, I'm cloning code from master branch to my local directory.所以,我将代码从 master 分支克隆到我的本地目录。 And when i open the code in (INTELLIJ Idea) on lower right side its shows master branch but instead of master branch i want my own branch(Branch i made from master branch) so that i can do changes on code and commit it and the commits only goes to my branch not master branch.
当我在右下角的(INTELLIJ Idea)中打开代码时,它显示了 master 分支,但我想要我自己的分支(我从 master 分支创建的分支)而不是 master 分支,这样我就可以对代码进行更改并提交它和提交只会转到我的分支而不是主分支。
I cloned from master branch and then used git checkout to switch to my branch but then the code also switches to the one i have on my branch instead of master branch.我从 master 分支克隆然后使用 git checkout 切换到我的分支但是代码也切换到我在我的分支而不是 master 分支上的那个。
but then the code also switches to the one I have on my branch instead of
master
branch.但随后代码也切换到我在我的分支而不是
master
分支上的代码。
That is expected.这是意料之中的。 Switching to an existing branch will update the working tree to reflect the latest branch commit content.
切换到现有分支将更新工作树以反映最新的分支提交内容。
You could create a new branch from master
instead: that new branch would start from the code from master
.您可以改为从
master
创建一个新分支:该新分支将从master
的代码开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.