20

My colleague merged some change for a production hotfix into his local master branch and then did a push of master to our GitHub repository. Now I'm try to update my local master branch with his changes. When a do a "git pull origin" from the git console it seems like it going fine by showing all the files. But, near the end it just stops with the message "Aborting".

I have no idea what to do next. Help?

UPDATE: So problem solved. The real root of the problem was that my colleague removed some entries from the .gitignore file in his branch that allowed several new files to come into his checkin. Since my local .gitignore was still ignoring those files, my local repo didn't think I had local working files to add to the index. I ended up deleting all the files and then the pull worked and brought them all in.

I'm definitely going to be more careful editing the .gitignore file and checking it in. I now have some new appreciation for its affect on other developers.

9
  • Actually, there's one other curiosity that may or may not be related. When my colleague did his push, things 'seemed' like they worked. But, when we went to GitHub, there weren't any new commits. Now his local branch view in GitExtensions looks correct and we were also able to see his changes in GitHub. So when you merge local then push, do you NOT expect to see a new commit on GitHub? And if not, how could I tell that master was changed by looking at GitHub?
    – sisdog
    Aug 12, 2011 at 0:18
  • 1
    @Tim, it shows you edited my post. Did you change something? I didn't know people could change my post and... why did you change it?
    – sisdog
    Aug 12, 2011 at 0:21
  • click on the "5 mins ago" in "edited 5 mins ago" and you'll see the diff. He just made a minor punctuation change. Aug 12, 2011 at 0:24
  • 2
    Take this discussion to meta.stackoverflow.com. Editing has been around for a while now. If you'll notice, you see a lot less 'how 2 code this' questions these days. Aug 12, 2011 at 0:31
  • 2
    See the FAQ on editing Aug 12, 2011 at 2:08

2 Answers 2

15

He probably put the commit somewhere in the existing commit tree, rather than on top of it.

Try this:

git fetch origin
git rebase origin/master

And if that doesn't work, just create a local branch of origin, cherry-pick your local commits onto it, reset master before whatever commit he merged, and then merge your local branch onto master.

My guess is that his push involved a --force at some point to avoid a not a fast-forward commit message. You don't want to do that, in the future.

6
  • Thanks @Stefan but I'm still running into issues. At least by running the rebase I received a little more info. At the end it said: Aborting - count not detach HEAD. Does that provide any more of a clue?
    – sisdog
    Aug 12, 2011 at 1:05
  • Do you have any files locally that would be changed by the rebase? Try checking out a copy of origin to a new branch, and see what that says. git checkout -b testbranch origin/master Aug 12, 2011 at 1:09
  • Well, I got the same error but this time I scrolled up in the window and learned something more. So, immediately after running the command I get this message: "error: The following untracked working tree files would be overwritten by checkout:". So, that's the real problem. But, what's the solution? I think my collegue altered the .gitignore file which added a bunch of new files into version control. It's showing me all those files. So should I maybe just get the latest .gitignore file first that then commit all the new files?
    – sisdog
    Aug 12, 2011 at 1:15
  • I'm read stackoverflow.com/questions/1125968/… but still am not sure of a direction.
    – sisdog
    Aug 12, 2011 at 1:25
  • So problem solved. The root of the problem was that my colleague removed some entries from the .gitignore file in his branch that allowed several new files to come into his checkin. Since my local .gitignore was still ignoring those files, it didn't think I had local working files to add to the index. I ended up deleting all the files and then the pull worked and brought them all in.
    – sisdog
    Aug 12, 2011 at 3:00
5

The root of the problem was that my colleague removed some entries from the .gitignore file in his branch that allowed several new files to come into his checkin. Since my local .gitignore was still ignoring those files, it didn't think I had local working files to add to the index. I ended up deleting all the files and then the pull worked and brought them all in.

Not the answer you're looking for? Browse other questions tagged or ask your own question.