Git Pull让我写合并消息 [英] Git pull asks me to write merge message

查看:149
本文介绍了Git Pull让我写合并消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的分支机构:

git checkout mybranchSample
git fetch
git pull origin master

然后,Git给我以下消息:

Then, Git gives me the following message:

请输入提交消息以说明为什么需要进行合并,
尤其是如果它将更新后的上游合并到主题分支中

Please enter a commit message to explain why this merge is necessary,
especially if it merges an updated upstream into a topic branch

在输入提交消息后,它将master合并到我的文件中.即使我没有处理master中的某些文件,当我键入git status时,它也会以绿色显示文件列表.

And after entering a commit message, it merges master into my files. And even though I haven't worked on some files from master, it shows the files list in green when I type git status.

这个问题不是发生在我的同事身上,而是我一个人. 这可能是什么原因?

This issue is not happening with my colleagues, but me only. What can be the reason behind this?

推荐答案

git pull基本上是一次执行两个操作:git fetch后跟一个git merge(除非您使用git pull --rebase,在这种情况下,您可以猜测会发生什么.)

git pull is basically two actions at once: git fetch followed by a git merge (unless you use git pull --rebase, in which case you can guess what happens).

您之所以会看到它,是因为Git不能像大多数时候那样进行快进合并.这样做的原因通常是因为您已经在本地git commit尝试拉的分支,现在您需要将远程更改与本地更改合并.

The reason you're seeing this is because Git can't do a fast-forward merge, like it can most of the time. The reason for that is usually because you've git committed locally to the branch you're trying to pull, and now you need to merge the remote changes with your local ones.

还值得注意的是,Git为您预先填充了合并消息,因此您实际上不需要键入任何内容.只需保存并退出,合并就应该完成了. (当然,除非存在合并冲突).

It's also worth noting that Git pre-populated the merge message for you, so you don't really need to type anything. Just save and exit, and the merge should be complete. (Unless, of course, there are merge conflicts).

这篇关于Git Pull让我写合并消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆