0

I have pulled master branch on GitHub and it's up to date.

Steps which I followed later:

  1. Pulled a branch branch1 using command git pull remote branch1
  2. Pulled master again using git pull origin master
  3. Changed a file ( on master )
  4. git add filename.txt
  5. git commit -m "committing filename.txt"
  6. git push

But when I pushed it merged branch1 to the master. How did this happen? As I had pulled master again, I was expecting branch1 to be overwritten.

What did I miss here?

JJD
  • 50,076
  • 60
  • 203
  • 339
Shridhar Kalagi
  • 161
  • 1
  • 1
  • 5
  • A pull merges the remote branch into your local branch. So if those two diverged, you get a merge commit. – poke Jun 02 '16 at 06:52
  • Please start up `gitk --all` to get a visual impression of the branches. You might want to include a screenshot here. – JJD Jun 02 '16 at 06:54
  • I got my mistake. Git Pull is nothing but git fetch and git merge. Hence the issue. Thanks for your inputs – Shridhar Kalagi Jun 02 '16 at 09:23

0 Answers0