简体   繁体   English

从 master 分支克隆代码到本地仓库

[英]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.

相关问题 从本地主节点创建本地分支 - Create a local branch from local master 使用JGit将存储库克隆到本地目录 - Cloning a repository to a local directory with JGit 将文件从 web 应用程序(弹簧启动)提交到 git 远程存储库,而不首先将存储库克隆为本地? 这可能吗 - commit file from a web application (spring boot) into git remote repository without first cloning the repo as local? is this possible 如何在不克隆本地存储库的情况下获取提交列表 - How to get the list of commits without cloning the repository in local 更改哪个文件夹是远程github存储库的主分支 - Change which folder is master branch of remote github repository Netbeans 8.0.1-远程存储库包含未合并到本地分支中的提交 - Netbeans 8.0.1 - Remote repository contains commits unmerged into the local branch 无法从scm存储库获取分支信息 - Cannot get the branch information from the scm repository 克隆存储库时出现JGit错误 - JGit error when cloning repository Spring Cloud Config Server仅从Master分支读取 - spring cloud config server reading only from master branch 如何将本地 android studio 项目推送到 master 分支现有文件夹中的 gitlab? - How can I push a local android studio project to gitlab in an existing folder in the master branch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM