From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
Peter Eriksen <s022018@student.dtu.dk>,
git@vger.kernel.org, Jon Loeliger <jdl@freescale.com>
Subject: Re: Now What?
Date: Thu, 03 Nov 2005 10:38:15 -0800 [thread overview]
Message-ID: <7vu0eth90o.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0511030926020.27915@g5.osdl.org> (Linus Torvalds's message of "Thu, 3 Nov 2005 09:27:05 -0800 (PST)")
Linus Torvalds <torvalds@osdl.org> writes:
> And that's exactly what "git reset --hard" is there for. It will reset to
> the old head of the branch you are on (ie HEAD), and get rid of everything
> that was done to the tree.
OK, then let's rewrite the procedure using 'reset --hard'. Then
we do not have to use 'checkout -f' afterwards. The advantage
of this approach is that 'reset --hard' would remove the new
files the failed merge might have left in your working tree,
while using 'checkout -f' would.
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.
First thing is to bring your tree to a known state, to make
recovery easier.
$ git reset --hard
would match your working tree to your .git/HEAD, i.e. your
"maint".
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 master
$ git pull . origin
If 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 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").
next prev parent reply other threads:[~2005-11-03 18:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-03 1:30 Now What? Jon Loeliger
2005-11-03 1:43 ` Chris Shoemaker
2005-11-03 9:00 ` Junio C Hamano
2005-11-03 18:51 ` Jon Loeliger
2005-11-06 20:33 ` Junio C Hamano
2005-11-03 8:38 ` Peter Eriksen
2005-11-03 10:00 ` Junio C Hamano
2005-11-03 17:05 ` Daniel Barkalow
2005-11-03 17:27 ` Linus Torvalds
2005-11-03 18:38 ` Junio C Hamano [this message]
2005-11-03 17:30 ` Peter Eriksen
2005-11-03 22:07 ` Junio C Hamano
2005-11-03 22:33 ` Josef Weidendorfer
2005-11-04 17:06 ` Daniel Barkalow
2005-11-03 17:25 ` Linus Torvalds
2005-11-03 8:58 ` Junio C Hamano
2005-11-03 20:55 ` Junio C Hamano
2005-11-03 22:17 ` Josef Weidendorfer
2005-11-03 22:51 ` Junio C Hamano
2005-11-03 23:26 ` Josef Weidendorfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vu0eth90o.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=jdl@freescale.com \
--cc=s022018@student.dtu.dk \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).