git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work?
Date: Fri, 21 Dec 2012 07:58:27 -0800	[thread overview]
Message-ID: <7v8v8r2y8s.fsf@alter.siamese.dyndns.org> (raw)

When you want to redo a branch forked from another branch (say
'master'), a handy way to work is to first detach HEAD at the
previous fork point:

    $ git checkout master...branch

and build an updated history on top of this state.  Once you are
done, you can verify your results with commands like:

    $ git show-branch branch HEAD
    $ git diff branch HEAD

and then finish it off with:

    $ git checkout -B branch

This way, you can keep the history of the previous round on 'branch'
until you are done with the new history you build on the detached
HEAD state, and if you do not like updated history, you can reset
back to branch@{1} easily.

But you may not even need to have such an easy access to the old
history and just want to restart, with:

    $ git checkout -B branch <old fork point>

Unfortunately, master...branch syntax does not seem to work for
specifying the "old fork point" for this purpose, even though we
have special case to support the syntax in the "detach at that
commit" case (the first command line example in this message).

Perhaps we should teach the <start-point> parser this syntax as
well?

             reply	other threads:[~2012-12-21 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 15:58 Junio C Hamano [this message]
     [not found] ` <CANiSa6jP_JN+DpDgYpWA9Aky9REJvFq3aR3Yj0vF3+axWvtmsw@mail.gmail.com>
2012-12-21 16:55   ` Fwd: [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work? Martin von Zweigbergk
2012-12-21 17:12     ` Junio C Hamano
2012-12-21 19:43       ` Michael Haggerty
2012-12-21 21:31         ` Martin von Zweigbergk
2012-12-21 21:45           ` Junio C Hamano
2012-12-21 21:59           ` Michael Haggerty

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=7v8v8r2y8s.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.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).