git – committing in the midst of a conflicted pull

Just a note about an git-experience I had in case it helps someone else…

  • I was doing a git pull and got a conflict (in the ChangeLog of all places).

  • I fixed the conflict and then tried to commit the fix. Git was mad:

    [gwking@beeter foo]$ git commit -m "fix changelog conflict"                                         
    ChangeLog: needs merge                                                                                
    ChangeLog: unmerged (9325d97bb00d84025506d7bb7a78ba5e245b0275)                                        
    ChangeLog: unmerged (63f7f2ba434dbdb4d98a0c9766ef22a40ece0abd)                                        
    ChangeLog: unmerged (4bba972e7d78619d3a5448357ed8773afd1edece)                                        
    error: Error building trees                                                                           

    Hmmm, what does that mean. Some googling revealed nothing useful and Wolfram Alpha wasn’t sure what to do with your input..

    I ended up flailing for a while before I remembered that I needed to git add the change before I committed.

    [gwking@beeter foo]$ git add ChangeLog                                                              
  • After that, git was happy again

    [gwking@beeter foo]$ git commit -m "fix changelog conflict"                                         
    [master]: created 1d6cba4: "fix changelog conflict"                                                   

Problem solved.