1

I am working on a git project with other people. One of them updated some files yesterday. Today I did git pull and it updated my files, like it should. Doesn't get more straightforward than that

However, it also marked all the changes that I fetched from the repo as local changes awaiting a commit. I tried reverting back and merging, I tried it again with pull. Nothing. The new files are still "uncommitted" (even though, again, they came from the server).

I'm awfully confused. What is going on here? Is git intentionally messing with me?

update

here's the output of git status

On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Changes to be committed:

    (... list of files modified\deleted\added etc.)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    (... list of untracked files)
yuvi
  • 18,155
  • 8
  • 56
  • 93
  • Can you add the output of `git status` to the post. – Anshul Goyal Jan 20 '15 at 09:58
  • 1
    Having the files as "changed" just after a `git pull` is a sure sign you have a line ending issue. The answer should be on the Git documentation about [formatting and whitespaces](http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#Formatting-and-Whitespace) but I cannot tell you what to do. After I did how it is explained there the problem persisted and I was more puzzled than before. Hope you have a better luck with (or understanding of) that documentation. :-) – axiac Jan 20 '15 at 10:03
  • @axiac that's probably not the issue, but thanks – yuvi Jan 20 '15 at 10:04
  • @mu無 updated. I'm confused by the line `All conflicts fixed but you are still merging` – yuvi Jan 20 '15 at 10:06
  • @yuvi that means that git (or you) made all the changes match up, but the "Changes to be committed" haven't been, well, committed, so you're still technically "merging" in git-speak. You should be able to see what changes are affecting your files by doing a `git diff ` and go from there. – rubenvb Jan 20 '15 at 10:08
  • In this case (after you added the output of `git status`) it looks like the merge was not completed. `git commit` should solve the issues. – axiac Jan 20 '15 at 10:09
  • @yuvi seems to me a case where one of the previous pull didn't go in all right. I would suggest making a backup copy if you have local changes, and then trying `git merge --abort` followed by a `git pull` to see if that fixes it. – Anshul Goyal Jan 20 '15 at 10:10
  • @mu無 I got `Automatic merge failed; fix conflicts and then commit the result.` – yuvi Jan 20 '15 at 10:57

1 Answers1

2

What pull does is that it fetches the uptodate files and performs a merge to any possible local changes. In your case, it seems there were local conflicts making automatic merge not possible. For that reason merge is still in progress and you need to resolve those conflicts.

What to do next? Depends on what you want. You can discard your local changes or finish the actual merge and then push back.

eis
  • 51,991
  • 13
  • 150
  • 199
  • I'd like to discard local changes. How can I tell git to do that? – yuvi Jan 20 '15 at 10:54
  • @yuvi to discard all local changes, see instructions from [this thread](http://stackoverflow.com/questions/1125968/force-git-to-overwrite-local-files-on-pull) – eis Jan 20 '15 at 12:13
  • great. feel free to accept the answer if you feel this solved it. – eis Jan 20 '15 at 17:51