git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: newbie question - git-pull and local branch merge

From
Junio C Hamano <junkio@cox.net>
Date
Dec 22, 2006, 10:46 UTC
Message-ID
<7vejqs1a3r.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<6bb9c1030612220227h2dc83a78u2e31e0f4e6801412@mail.gmail.com>
"Pelle Svensson" <pelle2004@gmail.com> writes:
> 8. git-pull <- Problem!
And the problem is...???
> Accidentally I had 2 files not committed and one of these also
> had changes in the git-pull master branch which git could
> not merge automatically.

So you had changes to fileA that you already committed, and further changes in your working tree, and Linus side updated that same file since you started working on it?

If that is the case, I suspect that the pull stopped saying something like "Entry ... not uptodate. Cannot merge." If that is the case I think your working tree has what you had before you started the pull. Deal with your own changes in the files you dirtied (say, commit them first) and pull again.

Otherwise, what happened was you had changes to fileB that you already committed, and Linus side also updated the same file in the meantime, and you did _not_ have any change to that fileB in your working tree (you might have had some other files locally modified). And the pull would have reported something like "CONFLICT (content)" in such a case.

$ git diff

will show you an output that looks like diff but not really (you can tell by its hunk header that have three '@' letters instead of normal two); you have a conflicted merge result, and have the usual conflict markers in that file. Edit the file to resolve conflict. Then say:

$ git update-index conflicted-file-1.c conflicted-file-2.c ... $ git commit

to record the merge commit. Do not update-index the files that you had your own changes before pulling -- those changes do not have anything to do with this merge and you do not want to record them as part of the merge.

Previous: Pelle SvenssonNext: Pelle Svensson
Message 2 of 4 in “newbie question - git-pull and local branch merge”
  1. Pelle SvenssonDec 22, 2006
  2. Junio C HamanoDec 22, 2006
  3. Pelle SvenssonDec 22, 2006
  4. Junio C HamanoDec 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.