0

Sometimes when I use git checkout master the changes made in my previous branch are automatically merged into master:

cat >> some_file.txt
change from branch1
git checkout master

This outputs that the changes made to some_file.txt are merged into master. For example:

M some_file.txt
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'

Why do I get a merge without explicitly telling git to do so? (Im using git from brew on OSX).

Dom
  • 1,687
  • 6
  • 27
  • 37
quiZ___
  • 109
  • 1
  • 9

1 Answers1

0

The checkout did not merge the file, git is just telling you that after the checkout some_file.txt is still modified from before tour checkout. That's what the M means not merge. As of now it is not merges nor added for commit.

If you don't want that version of some_file.txt you can always do git checkout master some_file.txt which should give you the some_file.txt that is currently on your master.

Dom
  • 1,687
  • 6
  • 27
  • 37