git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "John Dlugosz" <JDlugosz@TradeStation.com>
Cc: <git@vger.kernel.org>
Subject: Re: undoing something
Date: Mon, 16 Mar 2009 12:14:00 -0700	[thread overview]
Message-ID: <7veiwxwa9z.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <450196A1AAAE4B42A00A8B27A59278E70A2AEFA4@EXCHANGE.trad.tradestation.com> (John Dlugosz's message of "Mon, 16 Mar 2009 15:06:31 -0400")

"John Dlugosz" <JDlugosz@TradeStation.com> writes:

> I made a mistake.  Big deal, now that I know that git storage is
> immutable and changes just add to what's already there.  
>
> A quick look at
> 	git reflog show topic
> tells me that {1} is the one I want.  So, how do I rewind branch topic
> to point to topic@{1} ?
> I did it by making a tag, and then in gitk pointing to it and picking
> "reset to here" from the context menu.  
>
> A while back I was looking for the right/easy way to simply repoint my
> branch to where I wanted.  The best answer was to use push.

The answer was best only because in your previous question you wanted to
ensure fast-forwardness, i.e. "git push . origin/dev:dev" without plus in
front to cause it to fail if it is not fast-forward.

If you know you have one unwanted commit you would want to discard at the
tip of topic, you do not want fast-foward safety to kick in.

 (1) if you are on the topic branch, you can say "git reset --hard HEAD^";
     or

 (2) if you are not, you can obviously check out topic and do the above,
     or "git branch -f topic topic^".

If the garbage you have at the tip of the topic is not just a single
commit, you can replace HEAD^ and topic^ in the above with whatever commit
you would want to point the tip at.

  reply	other threads:[~2009-03-16 19:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 19:06 undoing something John Dlugosz
2009-03-16 19:14 ` Junio C Hamano [this message]
2009-03-16 19:48   ` John Dlugosz
2009-03-16 20:11     ` Junio C Hamano
2009-03-16 20:51       ` Effective Posting John Dlugosz
2009-03-16 21:29         ` René Scharfe
2009-03-16 21:38           ` John Dlugosz
2009-03-16 22:21         ` Jay Soffian
2009-03-16 22:36           ` John Dlugosz
2009-03-16 21:45     ` (unknown), Nanako Shiraishi
2009-03-17  7:09       ` undoing something Junio C Hamano
2009-03-17 14:06         ` [PATCH] git-branch.txt: document -f correctly Michael J Gruber
2009-03-17 16:37           ` Junio C Hamano
2009-03-17 16:46             ` Michael J Gruber
2009-03-17 15:08         ` undoing something John Dlugosz

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=7veiwxwa9z.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=JDlugosz@TradeStation.com \
    --cc=git@vger.kernel.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).