I pull from my branch:
git checkout mybranchSample git fetch git pull origin master
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
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?
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 commit ted locally to the branch you're trying to pull, and now you need to merge the remote changes with your local ones.
press "esc" (escape) write ":wq" (write & quit)
In a pull request, you propose that changes you've made on a head branch should be merged into a base branch. By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch.
Simple answer: git pull is, essentially, a combination of git fetch and then a git merge . As any merge, if Git finds out fast-forwarding is not possible, a traditional merge is necessary (one more commit with two parents), therefore this process asks for a commit message.
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).
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 commit
ted locally to the branch you're trying to pull, and now you need to merge the remote changes with your local ones.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With