[英]git pull origin master marks changes from master as modified in my feature branch
To update my feature branch with the latest changes from master, I used git pull origin master
.为了使用 master 的最新更改更新我的功能分支,我使用
git pull origin master
。
I then received a message that says there are conflicts which I need to resolve first.然后我收到一条消息,说存在我需要先解决的冲突。 I manually resolved those conflicts, but when I tried to run
git status
, I expect git to show only the files that I modified as a result of resolving the conflicts.我手动解决了这些冲突,但是当我尝试运行
git status
时,我希望 git 仅显示我因解决冲突而修改的文件。 The problem is that the changes from master that were not in my feature branch are marked as 'modified' as well.问题是不在我的功能分支中的来自 master 的更改也被标记为“已修改”。
How do I pull changes from master such that git will only recognize the files that I really modified and not those that just came from master?如何从 master 中提取更改,以便 git 只能识别我真正修改过的文件,而不是那些刚刚来自 master 的文件? I've been using git in a multi user environment just for a while now, and know that my previous git pulls doesn't recognize changes in master.
我在多用户环境中使用 git 已经有一段时间了,并且知道我之前的 git 拉动无法识别主控的变化。 Or maybe is it because of the conflict?
或者也许是因为冲突? If so how do I tell git to just merge those changes without marking them as modified?
如果是这样,我如何告诉 git 只合并这些更改而不将它们标记为已修改?
This is correct and is how it is supposed to behave.这是正确的,也是它应该表现的方式。 When you take a pull, a new commit happens into your feature branch which you enter a commit message for.
当您进行拉取时,新的提交会发生在您输入提交消息的功能分支中。
When you take a pull and face conflicts, you are supposed to resolve the conflicts.当你拉动并面对冲突时,你应该解决冲突。 Remember that the commit that has to happen on a pull (merge) has not happened yet.
请记住,在拉取(合并)时必须发生的提交尚未发生。 These will show up as files changed and you've got to add them and make a commit, which essentially is equivalent to the commit that would have occurred in case of a pull with no conflicts.
这些将显示为文件更改,您必须添加它们并进行提交,这基本上相当于在没有冲突的情况下发生的提交。
If you pull from the master branch then all the changes are not in the feature branch so they will show you when you merged.如果您从主分支中提取,那么所有更改都不在功能分支中,因此它们会在您合并时显示给您。 So when you merged and conflict occurs and after you resolved and run the git status then you have find out the two sections
因此,当您合并并发生冲突时,在您解决并运行 git 状态后,您将找到这两个部分
After you resolved the conflict you need to add those files using git add and make commit and push the feature branch so now you successfully merged the master branch into the feature branch.解决冲突后,您需要使用 git 添加这些文件,添加并提交并推送功能分支,因此现在您已成功将主分支合并到功能分支中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.