Today I was using Git and something happened to me which I didn't know how to deal with.
I was on branch development
, and I did git fetch
to get the new origin/master
. I wanted to merge origin/master
into master
, and end up with the updated master
checked out. Normally, I would do this:
git checkout master
git pull
But there was a problem; the currently checked-out branch development
had a .gitignore
which included a lot of files that the old master
didn't. The old master
had these files version-controlled. So Git wouldn't let me checkout master
, because then these files would be overwritten.
I didn't know what to do, so I simply checked out origin/master
instead.
If there was a way to merge origin/master
into master
without checking out master
, I think that would have saved me. (And it was a fast-forward merge, so Merge-Fail wasn't an option.)
What can I do about this?