* Checking out orphans with -f
@ 2012-01-18 19:07 Martin Fick
2012-01-18 22:40 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Martin Fick @ 2012-01-18 19:07 UTC (permalink / raw)
To: git
I am trying to write some scripts which do various things to
a git repo and I have run into a issue where I think that
git behavior with respect to orphan branches is potentially
undesirable. If I type:
git checkout --orphan a
I cannot easily abandon this state by simply typing:
git check -f --orphan b
Is there a better simpler way to abandon a that I am not
aware of? Am I miss understanding what -f is supposed to
do? It seems like it should allow me to abandon the a
orphan and continue to checkout the b orphan?
Thanks for any insights,
-Martin
--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking out orphans with -f
2012-01-18 19:07 Checking out orphans with -f Martin Fick
@ 2012-01-18 22:40 ` Junio C Hamano
2012-01-18 22:45 ` Martin Fick
2012-01-18 22:50 ` Martin Fick
0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-01-18 22:40 UTC (permalink / raw)
To: Martin Fick; +Cc: git
Martin Fick <mfick@codeaurora.org> writes:
> I am trying to write some scripts which do various things to
> a git repo and I have run into a issue where I think that
> git behavior with respect to orphan branches is potentially
> undesirable. If I type:
>
> git checkout --orphan a
>
> I cannot easily abandon this state
What do you mean by "abandon"?
If you want to remove a branch "a" because you do not need it, you can
check out some other branch and say "git branch -D a", no?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking out orphans with -f
2012-01-18 22:40 ` Junio C Hamano
@ 2012-01-18 22:45 ` Martin Fick
2012-01-18 22:50 ` Martin Fick
1 sibling, 0 replies; 5+ messages in thread
From: Martin Fick @ 2012-01-18 22:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wednesday, January 18, 2012 03:40:36 pm Junio C Hamano
wrote:
> Martin Fick <mfick@codeaurora.org> writes:
> > I am trying to write some scripts which do various
> > things to a git repo and I have run into a issue where
> > I think that git behavior with respect to orphan
> > branches is potentially
> >
> > undesirable. If I type:
> > git checkout --orphan a
> >
> > I cannot easily abandon this state
>
> What do you mean by "abandon"?
>
> If you want to remove a branch "a" because you do not
> need it, you can check out some other branch and say
> "git branch -D a", no?
By abandon, I simply mean to check out another branch, which
as you point, I can almost do. I just can't do it by
checking out another orphaned branch! Why not, this seems
inconsistent? In both cases I loose what the original
orphaned branch (a) is, so why prevent me from doing it in
the one case and not the other?
-Martin
--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking out orphans with -f
2012-01-18 22:40 ` Junio C Hamano
2012-01-18 22:45 ` Martin Fick
@ 2012-01-18 22:50 ` Martin Fick
2012-01-18 23:12 ` Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Martin Fick @ 2012-01-18 22:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wednesday, January 18, 2012 03:40:36 pm Junio C Hamano
wrote:
> Martin Fick <mfick@codeaurora.org> writes:
> > I am trying to write some scripts which do various
> > things to a git repo and I have run into a issue where
> > I think that git behavior with respect to orphan
> > branches is potentially
> >
> > undesirable. If I type:
> > git checkout --orphan a
> >
> > I cannot easily abandon this state
>
> What do you mean by "abandon"?
>
> If you want to remove a branch "a" because you do not
> need it, you can check out some other branch and say
> "git branch -D a", no?
Actually, no I can't. I can check out some other branch
(assuming I have one), but I cannot then delete a, it
appears to already be deleted by virtue of checking out
another branch. I like that since I never checked it in,
better to clean up the garbage, but why can't I then
checkout another orphan to do the same thing?
-Martin
--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Checking out orphans with -f
2012-01-18 22:50 ` Martin Fick
@ 2012-01-18 23:12 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-01-18 23:12 UTC (permalink / raw)
To: Martin Fick; +Cc: git
Martin Fick <mfick@codeaurora.org> writes:
> Actually, no I can't. I can check out some other branch
> (assuming I have one), but I cannot then delete a, it
> appears to already be deleted by virtue of checking out
> another branch. I like that since I never checked it in,
> better to clean up the garbage.
Good.
> ...but why can't I then
> checkout another orphan to do the same thing?
I am not surprised if the original contributor who wanted to add --orphan
did not address corner cases. It is very plausible that we did not try as
hard to nitpick the code for complete support of such corner cases as I
and other contributors usually do for more important features.
So... Patches welcome ;-)
Having said that, there are many things to consider to fill the corner
case you seem to be interested to add support for.
The "orphaned" state is like immediately after "git init". Because you do
not have any current commit, you cannot create an orphan branch based the
state immediately after "git init", either. You are nominally on your
'master' branch, but it does not have anything yet; you are expected to
turn it into a real branch by creating a commit soon, but until you do so,
you are kind of in-limbo. It is understandable that there will be many
operations that will not make any sense until you first get out of this
in-limbo state. For example, you cannot (and do not have to) delete the
branch and if you have a commit (e.g. you can fetch one from another
place) you can check it out and the 'master' will be gone, because you
never created it in the first place.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-18 23:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 19:07 Checking out orphans with -f Martin Fick
2012-01-18 22:40 ` Junio C Hamano
2012-01-18 22:45 ` Martin Fick
2012-01-18 22:50 ` Martin Fick
2012-01-18 23:12 ` Junio C Hamano
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).