git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Peter MacMillan <peterm@metavera.com>
To: git@vger.kernel.org
Subject: stage/commit issue when checking out a branch
Date: Tue, 12 May 2009 12:01:14 -0400	[thread overview]
Message-ID: <d96d20670905120901qa4c0353xc50160f880e17a21@mail.gmail.com> (raw)

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@metavera.com>
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@metavera.com>

Application Developer, Metavera Solutions Inc.
502-2221 Yonge Street, Toronto, ON, M4S 2B4
416-598-9300 x 27

             reply	other threads:[~2009-05-12 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 16:01 Peter MacMillan [this message]
2009-05-12 16:38 ` stage/commit issue when checking out a branch Junio C Hamano
2009-05-12 16:56 ` [PATCH] Revert "checkout branch: prime cache-tree fully" Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d96d20670905120901qa4c0353xc50160f880e17a21@mail.gmail.com \
    --to=peterm@metavera.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).