git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work?
@ 2012-12-21 15:58 Junio C Hamano
       [not found] ` <CANiSa6jP_JN+DpDgYpWA9Aky9REJvFq3aR3Yj0vF3+axWvtmsw@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-12-21 15:58 UTC (permalink / raw)
  To: git

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-12-21 22:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-21 15:58 [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work? Junio C Hamano
     [not found] ` <CANiSa6jP_JN+DpDgYpWA9Aky9REJvFq3aR3Yj0vF3+axWvtmsw@mail.gmail.com>
2012-12-21 16:55   ` Fwd: " 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

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).