While working in a branch I’ll have a few files that I’m changing. One of my colleagues tells me that he’s pushed a change that I should pull to fix an immediate issue. If I don’t commit my changes, git won’t let me pull. Even though none of my files I have modified are being updated.
I’m wondering why this is the case and if possible, is there a way to avoid this?
git pullis essentially a fetch followed by a merge. Merges usually require that the working directory is in a clean state; they do that for your safety:And:
I believe that the check in a pure
git mergeis actually more forgiving than in agit pull, so you might want to try fetching first and then merging manually. But it’s always a better idea to stash things away first.