Re: Now What?
- From
Junio C Hamano <junkio@cox.net>
- Date
- Nov 3, 2005, 10:00 UTC
- Message-ID
- <7v4q6uhx0a.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20051103083840.GA28300@ebar091.ebar.dtu.dk>
"Peter Eriksen" <s022018@student.dtu.dk> writes:
Show 8 quoted lines
> Here's one I've done too many times: > > ~/git/git-core]cat .git/remotes/origin > URL: git://git.kernel.org/pub/scm/git/git.git > Pull: master:origin > > ~/git/git-core]git-checkout maint > ~/git/git-core]git pull
You are merging my master into your "maint", probably a copy of my (previous) maint.
What now? Depends on what you wanted to do. If what you wanted to do was to merge my "master" to your "maint", then you would resolve the conflicts by hand, but probably that was not what you wanted to do.
After that pull, your repository is in this state:
. the index file and working tree is somewhere between your "maint" and my "master". "somewhere between" is because the merge obviously failed.
. the "maint" head has not moved. Your .git/HEAD points at the "maint" branch.
. the "origin" head points at my latest "master" head.
If you keep a copy of my "master" plus zero or more of your own development in your "master" branch, and what you wanted to do was to build my "master" plus those developments of your own, then:
$ git checkout -f master
$ git pull . originIf your "master" is just a vanilla copy of my "master", then this pull would result in a fast forward, and "master" and "origin" will point at the same commit after this pull operation. Otherwise, you would merge your changes and my "master" updates into your "master" branch.
If what you wanted to do was to build my "master" vanilla, then:
$ git checkout -f origin
because your remotes/origin says "origin" is meant to be a straight copy of my "master".
A good habit to get into is, before pulling, make sure:
. your index matches your HEAD.
. the local modification (i.e. what git-diff-files would report) is something you do not mind losing.
. you are on the right branch you want to pull into (check with "git branch").