git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git commit (or git-commit-script) question

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 19, 2005, 17:36 UTC
Message-ID
<Pine.LNX.4.58.0508191028190.3412@g5.osdl.org>
In-Reply-To
<4306119C.8000600@jstenback.com>
On Fri, 19 Aug 2005, Johnny Stenback wrote:
Show 12 quoted lines
> 
> That made me assume that if I do:
> 
>    git-commit-script somedir
> 
> it would *only* commit the changes I've made in "somedir", but it 
> appears to commit *all* files that have changed (and shows all files in 
> the list of changed files in the commit message it displays in the 
> editor), as if it's completely ignoring the <path> argument.
> 
> Known problem? I got this using git that I pulled from kernel.org 
> earlier this morning.
It works for me. You _should_ see something like
	#
	# Updated but not checked in:
	#   (will commit)
	#
	#       modified: somedir/somefile
	#
	#
	# Changed but not updated:
	#   (use git-update-cache to mark for commit)
	#
	#	modified: otherdir/anotherfile
	#

which basically means that it will commit "somedir/somefile", but _not_ commit "otherdir/anotherfile".

However, one thing to look out for is that if you've marked any files for update (with git-update-cache) those will always be committed regardless of what arguments you give to "git commit". You can reset the index with "git reset" if you decided that you don't want to commit after all.

(For example, if you do a "git commit --all", but decide not to commit after all by writing an empty commit message, that will already have marked all the files to be committed, so next time, even if you then use "git commit somedir", all the files in all the _other_ dirs have already been marked for update, so you'll see everything being committed).

			Linus
Previous: Johnny StenbackNext: Johnny Stenback
Message 2 of 4 in “git commit (or git-commit-script) question”
  1. Johnny StenbackAug 19, 2005
  2. Linus TorvaldsAug 19, 2005
  3. Johnny StenbackAug 19, 2005
  4. Junio C HamanoAug 19, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.