git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Paul Jakma <paul@clubi.ie>
Cc: git list <git@vger.kernel.org>
Subject: Re: seperate commits for objects already updated in index?
Date: Tue, 14 Mar 2006 09:00:30 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0603140856120.3618@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0603141634010.5276@sheen.jakma.org>



On Tue, 14 Mar 2006, Paul Jakma wrote:

> Hi,
> 
> Dumb question, imagine you made changes to a few files, and ran update-index
> at various stages in between:
> 
> $ git status
> #
> # Updated but not checked in:
> #   (will commit)
> #
> #       modified: foo/ChangeLog
> #       modified: foo/whatever
> #       modified: bar/ChangeLog
> #       modified: bar/other
> 
> The changes in bar/ are unrelated to the changes in foo/ - how do you commit
> each seperately? Git doesn't seem to want to let me:
> 
>   $ git commit -o bar
>   Different in index and the last commit:
>   M       bar/ChangeLog
>   M       bar/other
>   You might have meant to say 'git commit -i paths...', perhaps?
> 
> git commit on its own wants to commit all the above files.
> 
> what's the silly thing I've missed?

You've already marked them all modified in the index (using 
git-update-index), so git commit thinks you are confused by naming them 
again and saying "only".

The simplest thing to do is to do

	git reset

to reset your index back to your HEAD (but obviously DON'T use the "-f" 
flag, which will also force the working tree!). That will make your index 
clean, and undo the fact that you've already marked things to be committed 
with "git-update-index".

Then you can just do

	git commit -o bar

and everything should be fine, because then git doesn't think you're doing 
something insane.

		Linus

  reply	other threads:[~2006-03-14 17:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-14 16:37 seperate commits for objects already updated in index? Paul Jakma
2006-03-14 17:00 ` Linus Torvalds [this message]
2006-03-14 17:04   ` Paul Jakma
2006-03-14 17:20     ` Linus Torvalds
2006-03-14 17:27       ` Paul Jakma
2006-03-14 23:51       ` Junio C Hamano
2006-03-15  3:24         ` Junio C Hamano
2006-03-15 13:28           ` Paul Jakma
2006-03-15 14:00           ` Andreas Ericsson
2006-03-15 19:25             ` Junio C Hamano
2006-03-15 19:43               ` Andreas Ericsson

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

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

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0603140856120.3618@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    --cc=paul@clubi.ie \
    /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.
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).