git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* `git checkout --orpan` leaves a dirty worktree
@ 2013-02-08 19:50 Ramkumar Ramachandra
  2013-02-08 20:04 ` Jonathan Nieder
  2013-02-08 20:31 ` Martin von Zweigbergk
  0 siblings, 2 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-02-08 19:50 UTC (permalink / raw)
  To: Git List

Hi,

Why should I have to `git rm -rf .` after a `git checkout --orphan`?
What sort of misfeature/ incomplete feature is this?

Ram

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 19:50 `git checkout --orpan` leaves a dirty worktree Ramkumar Ramachandra
@ 2013-02-08 20:04 ` Jonathan Nieder
  2013-02-08 20:11   ` Ramkumar Ramachandra
  2013-02-08 20:12   ` Junio C Hamano
  2013-02-08 20:31 ` Martin von Zweigbergk
  1 sibling, 2 replies; 8+ messages in thread
From: Jonathan Nieder @ 2013-02-08 20:04 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Ramkumar Ramachandra wrote:

> Why should I have to `git rm -rf .` after a `git checkout --orphan`?
> What sort of misfeature/ incomplete feature is this?

One designed for the "going open source" use case, where you have
existing code that you want to put into a new branch without history.
When there is no existing code, it seems simpler to do

	cd ..
	git init code-that-has-nothing-to-do-previous-cwd
	cd code-that-*
	... hack hack hack ...
	git commit
	git remote add origin <url>
	git push -u origin master

BTW, I suspect a clearer way to say what you meant is "Sounds like a
misfeature" which is gentler and more focused than an implied "What
kind of idiot designed this?"  Even if you are thinking the latter. :)

Hope that helps,
Jonathan

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 20:04 ` Jonathan Nieder
@ 2013-02-08 20:11   ` Ramkumar Ramachandra
  2013-02-08 20:17     ` Junio C Hamano
  2013-02-08 20:12   ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-02-08 20:11 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git List

Jonathan Nieder wrote:
> Ramkumar Ramachandra wrote:
> One designed for the "going open source" use case, where you have
> existing code that you want to put into a new branch without history.

> BTW, I suspect a clearer way to say what you meant is "Sounds like a
> misfeature" which is gentler and more focused than an implied "What
> kind of idiot designed this?"  Even if you are thinking the latter. :)

Yes, I do feel stupid now.

BTW, Is there a better way to clean out the worktree than `git rm -rf
.`, since that fails for submodules?  The impulsive `reset --hard`
obviously fails because there is no HEAD.

Thanks.

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 20:04 ` Jonathan Nieder
  2013-02-08 20:11   ` Ramkumar Ramachandra
@ 2013-02-08 20:12   ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2013-02-08 20:12 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Ramkumar Ramachandra, Git List

Jonathan Nieder <jrnieder@gmail.com> writes:

> Ramkumar Ramachandra wrote:
>
>> Why should I have to `git rm -rf .` after a `git checkout --orphan`?
>> What sort of misfeature/ incomplete feature is this?
>
> One designed for the "going open source" use case, where you have
> existing code that you want to put into a new branch without history.
> When there is no existing code, it seems simpler to do
>
> 	cd ..
> 	git init code-that-has-nothing-to-do-previous-cwd
> 	cd code-that-*
> 	... hack hack hack ...
> 	git commit
> 	git remote add origin <url>
> 	git push -u origin master
>
> BTW, I suspect a clearer way to say what you meant is "Sounds like a
> misfeature" which is gentler and more focused than an implied "What
> kind of idiot designed this?"  Even if you are thinking the latter. :)

So true ;-).  

Especially when you may an answer that may make _you_ look like an
idiot ;-)

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 20:11   ` Ramkumar Ramachandra
@ 2013-02-08 20:17     ` Junio C Hamano
  2013-02-10 20:10       ` Jens Lehmann
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2013-02-08 20:17 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Jonathan Nieder, Git List

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> BTW, Is there a better way to clean out the worktree than `git rm -rf
> .`, since that fails for submodules?  The impulsive `reset --hard`
> obviously fails because there is no HEAD.

I _think_ the "git rm" is one of the things on Jens's roadmap.  Also
I think "reset --hard" these days does know what to do when you do
not have any history yet.

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 19:50 `git checkout --orpan` leaves a dirty worktree Ramkumar Ramachandra
  2013-02-08 20:04 ` Jonathan Nieder
@ 2013-02-08 20:31 ` Martin von Zweigbergk
  2013-02-08 20:38   ` Ramkumar Ramachandra
  1 sibling, 1 reply; 8+ messages in thread
From: Martin von Zweigbergk @ 2013-02-08 20:31 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

I'm curious what your use case is.

The behavior has been inconvenient for me too, but I have only used it
in test cases; I have no real use case where I wanted to create an
unborn/orphan branch.

On Fri, Feb 8, 2013 at 11:50 AM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Hi,
>
> Why should I have to `git rm -rf .` after a `git checkout --orphan`?
> What sort of misfeature/ incomplete feature is this?
>
> Ram
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 20:31 ` Martin von Zweigbergk
@ 2013-02-08 20:38   ` Ramkumar Ramachandra
  0 siblings, 0 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-02-08 20:38 UTC (permalink / raw)
  To: Martin von Zweigbergk; +Cc: Git List

Martin von Zweigbergk wrote:
> I'm curious what your use case is.

A couple of them off the top of my head: the gh-pages branch in
GitHub, restarting a project but keeping the old history around for
reference.

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

* Re: `git checkout --orpan` leaves a dirty worktree
  2013-02-08 20:17     ` Junio C Hamano
@ 2013-02-10 20:10       ` Jens Lehmann
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Lehmann @ 2013-02-10 20:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramkumar Ramachandra, Jonathan Nieder, Git List

Am 08.02.2013 21:17, schrieb Junio C Hamano:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
> 
>> BTW, Is there a better way to clean out the worktree than `git rm -rf
>> .`, since that fails for submodules?  The impulsive `reset --hard`
>> obviously fails because there is no HEAD.
> 
> I _think_ the "git rm" is one of the things on Jens's roadmap.

Hmm, "git rm" does remove submodules since 1.8.1 (but they have to be
cloned with Git 1.7.8 or newer). Or is there something special about
the orphan checkout I'm missing here?

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

end of thread, other threads:[~2013-02-10 20:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08 19:50 `git checkout --orpan` leaves a dirty worktree Ramkumar Ramachandra
2013-02-08 20:04 ` Jonathan Nieder
2013-02-08 20:11   ` Ramkumar Ramachandra
2013-02-08 20:17     ` Junio C Hamano
2013-02-10 20:10       ` Jens Lehmann
2013-02-08 20:12   ` Junio C Hamano
2013-02-08 20:31 ` Martin von Zweigbergk
2013-02-08 20:38   ` Ramkumar Ramachandra

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