Re: [git-users] Problem with git checkout --orphan

2013-06-07 Thread Konstantin Khomoutov
On Thu, 6 Jun 2013 14:51:50 -0400
wor...@alum.mit.edu (Dale R. Worley) wrote:

[...]

 $ git --version
 git version 1.7.7.6

[...]

 $ # Try to create an orphaned branch.  This fails.
 $ git checkout --orphan first-new-branch
 fatal: You are on a branch yet to be born

Works for me with Git 1.8.1:

C:\tmp\foogit init
Initialized empty Git repository in C:/tmp/foo/.git/

C:\tmp\foogit checkout --orphan foo
Switched to a new branch 'foo'

C:\tmp\foogit checkout --orphan foo2
Switched to a new branch 'foo2'

C:\tmp\foogit checkout --orphan foo3
Switched to a new branch 'foo3'

C:\tmp\foogit --version
git version 1.8.1.msysgit.1

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Problem with git checkout --orphan

2013-06-07 Thread Dale R. Worley
 From: Konstantin Khomoutov flatw...@users.sourceforge.net
 
 Works for me with Git 1.8.1:

Good.  I will check again when I upgrade to Git =1.8.1.

Dale

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Problem with git checkout --orphan

2013-06-07 Thread Konstantin Khomoutov
On Fri, 7 Jun 2013 11:30:38 -0400
wor...@alum.mit.edu (Dale R. Worley) wrote:

  From: Konstantin Khomoutov flatw...@users.sourceforge.net
  
  Works for me with Git 1.8.1:
 
 Good.  I will check again when I upgrade to Git =1.8.1.

Looks like that was fixed by commit abe1998 [1] (and further improved
since -- just do `git log --grep unborn -F` on Git master).

1. https://github.com/git/git/commit/abe1998

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[git-users] Problem with git checkout --orphan

2013-06-06 Thread Dale R. Worley
When you want to create a new branch that has no ancestors, you use
git checkout --orphan to set the repository in a state where the
next commit will have no parents.  However, it appears that one can
only do git checkout --orphan only if the *current* state will *not*
create an orphan commit.  This makes no sense, because the current
repository state has nothing to do with setting up the next state.

Here is a script that shows the problem:

$ git --version
git version 1.7.7.6

$ # Make a test directory.
$ DIR=temp.$$
$ mkdir $DIR
$ cd $DIR

$ # Create a new repository.
$ rm -rf .git
$ git init
Initialized empty Git repository in 
/common/home/worley/git-checkout/temp.19517/.git/

$ # Try to create an orphaned branch.  This fails.
$ git checkout --orphan first-new-branch
fatal: You are on a branch yet to be born

$ # Create a commit on branch master.  (We are still on master.)
$ git commit --allow-empty -m 'Empty commit.'
[master (root-commit) db3f0dd] Empty commit.

$ # Try to create an orphaned branch.  This succeeds.
$ git checkout --orphan second-new-branch
Switched to a new branch 'second-new-branch'

$ # Show the Git status.
$ git branch
  master
$ cat .git/HEAD
ref: refs/heads/second-new-branch

$ # But now we can't create another orphaned branch!
$ git checkout --orphan third-new-branch
fatal: You are on a branch yet to be born
$ 

Dale

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.