简体   繁体   English

git pull origin master 标记从 master 更改为在我的功能分支中修改

[英]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 状态后,您将找到这两个部分

  1. Changes to be committed:要提交的更改:
  2. Unmerged paths:未合并路径:

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.

相关问题 功能分支上的`git pull --rebase`合并到原点/主更改中 - `git pull --rebase` on feature branch to merge in origin/master changes `git pull origin master`进入我的结账功能分支 - `git pull origin master` into my checkout feature branch 为什么“ git pull origin feature-12345 master”是更新我的pull request分支的唯一方法? - Why is “git pull origin feature-12345 master” the only way to update my pull request branch? 如何从Git中的功能分支将上游/母版合并到原始/母版中? - How to merge upstream/master into origin/master from a feature branch in Git? 无法将主分支从源拉入本地(已修改)存储库 - Unable to pull master branch from origin into local (modified) repo 当我从功能分支执行“git pull origin master --rebase”时,我收到过时的传入代码 - When I do “git pull origin master --rebase” from a feature branch, I receive outdated incoming code 有没有办法从我的分支中提取主更改? - Is there a way to pull the master changes from my branch? 我可以使用 git push origin master:myBranch 将我在 master 分支中修改的代码推送到我的分支吗? - Can I use git push origin master:myBranch to push code I modified in master branch to my branch? git 在使用主分支重新设置功能分支之后拉功能分支将恢复重新设置更改 - git pull feature branch just after rebasing feature branch with master branch will revert rebase changes Git拉起源 <branch> 覆盖大师? - Git pull origin <branch> overwrites master?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM