Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git checkout -b: unparent the new branch with -o

From: Erick Mattos <hidden>
Date: 2016-06-15 22:48:21

Hi,
quoted
Subject: [PATCH] git checkout -b: unparent the new branch with -o
I would say it is rather: "git checkout -b: allow creating unrelated branch",
or something like that.
I don't see a point to change something specific to a general not yet
defined option.
By the way, for the solution to be complete it should work not only for
"git checkout -b" shortcut, but also for "git branch".
That is not the idea.  The idea is to start coding a new orphan
branch.  Not to create an empty orphan branch for later.

Also it is not meant to clone a commit to a new orphan branch.  Even
though this could be done, using "git checkout TARGET; git checkout
-ob NEW_BRANCH; git add .; git commit -C/-c TARGET --reset-author".

It is meant to start a parallel development which will be connected to
existing ones.  Of course there will be other possible uses (I always
trust in people inventiveness).
quoted
Sometimes it is necessary to start up a new development branch of code
intended to be merged in the near future to existing branches but which
actually does not relate to them.
I'm not sure if 'unrelated but _intended to merge_' is most common
workflow utilizing unrelated branches... and whether git should
promote such workflow, even if only describing it in the commit
message.
This is dependent of point-of-view.  So thank you very much for sharing yours.

Anyway all those unrelated branches uses you mentioned would be
satisfied by this new option.
quoted
The new -o/--orphan is intended to solve this situation allowing the
creation of a new branch unparented to any other.
I think that for example '--root', or '--rootless', or '--unrelated'
would be a better name than '--orphan'.  Besides I don't think that
such rarely used option should squat on rare resource of single-letter
option.
Parent is the term employed even by the commits itself to describe the
commit of origin so I don't think those suggestions are nice.  I do
agree about the importance of single-letters because we only have 26
but in this case it would be only the fifth used.
quoted
Signed-off-by: Erick Mattos <redacted>
---
[...]
quoted
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git checkout' [-q] [-f] [-m] [<branch>]
-'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<start_point>]
+'git checkout' [-q] [-f] [-m] [-b <new_branch> [-o]] [<start_point>]
This is not stricly correct, as you can use either '-o' OR '<start_point>',
but not both (but you can use '-o' only together with '-b <new_branch>').
You are right on that because start_point would be useless.

quoted
+-o::
+--orphan::
+     When creating a new branch, set it up as unparented thus
+     unrelated to the previous branch.
+
Unparented?  Perhaps "set it up so first commit on this branch would
be root (parenless) commit".  Hmmm... it is not easy to describe it
well...
Everything we try do define with human language is incomplete.  So we
normally employ added layers of information to better describe things
as much as requested.

In our case we start with a single word represented by a letter or not
that try to give an idea.  If not enough, by --help or when people use
it incorrectly they will get a small message describing the intended
use better.  Then by a 'man' a paragraph.  Further text is added to
the 'man' if necessary. And then the help files, tutorials and other
people.

I think all off those steps were taken correctly in this case and that
what is written now is good enough.

Thank you very much for your comments.  I did appreciate it.

Best regards.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help