stage/commit issue when checking out a branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I've run into a problem where staging changes, checking out a
different branch, and then commiting results in an empty commit.

Here is a simplified reproduction of the problem:

currently using 1.6.3, verified that it works correctly in git version 1.6.1.3.

New repo:

$ mkdir bug
$ cd bug
$ git init
Initialized empty Git repository in /home/peterm/bug/.git/

New file:

$ echo "Hello" > FILE
$ git add FILE
$ git commit -m "V1"
[master (root-commit) 5aeea22] V1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 FILE

Simple change:

$ echo "Hello, world." > FILE
$ git add FILE

Move to a different branch:

$ git checkout -b branch
M	FILE
Switched to a new branch 'branch'
$ git status
# On branch branch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   FILE
#

Oh, still on the stage. Great. Commit!

$ git commit -m "V2"
[branch 818175e] V2
$ git show HEAD
commit 818175efc55d2e23871541c5caa2fe771c825b73
Author: Peter MacMillan <peterm@xxxxxxxxxxxx>
Date:   Tue May 12 11:38:02 2009 -0400

    V2
$ git status
# On branch branch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   FILE
#

Guh? A few of us at the office have hit this and it used to work. The
only way to commit the stage is to reset to HEAD, re-add and then
commit.

Thanks for your help,

Peter MacMillan <peterm@xxxxxxxxxxxx>

Application Developer, Metavera Solutions Inc.
502-2221 Yonge Street, Toronto, ON, M4S 2B4
416-598-9300 x 27
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]