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

Re: Git commit won't add an untracked file given on the command line

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Nov 19, 2008, 23:52 UTC
Message-ID
<alpine.LNX.1.00.0811191809430.19665@iabervon.org>
In-Reply-To
<7v7i6zs4ay.fsf@gitster.siamese.dyndns.org>
On Wed, 19 Nov 2008, Junio C Hamano wrote:
Show 24 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > I don't think that's what Mark wants, in this case. He's looking for the 
> > ability to have "git commit" act on a temporary index created by adding to 
> > the parent commit explicitly named files which aren't in the non-temporary 
> > index.
> 
> Ah, I think that it would not be an entirely unreasonable thing to do
> (cf. Message-Id: <7vtza4trdp.fsf@gitster.siamese.dyndns.org>).
> 
> You can say "git add that/directory" and .gitignore mechanism protects you
> from crufts in that/directory, so fearing "git commit that/directory" to
> add random junk to the next commit is not a reason to fear it.
> 
> But that is a huge behaviour change.  For example, I have a handful test
> scripts in my t/ directory (all named following the usual t????-*.sh
> naming convention) that I do not want to commit.  Today, after making
> changes to the tracked test scripts, I can rely on "git commit t/" not to
> include them in the commit, and I've _learned_ to trust that behaviour.
> I'd be surprised if others who have used git for more than a few months
> haven't done so as well.
> 
> Allowing what Mark wants without any explicit user customization will be a
> disaster to the end user experience.

There are two possible limits that would preserve your case while handling Mark's case: one is to only look at untracked files at all for names that don't match any tracked files, and the other (independantly) is to treat names as single filenames instead of patterns for untracked files.

Either of these (or both) should keep the existing behavior for using a pattern on the command line as a filter for which of the tracked files to commit (since any pattern of tracked files won't be the name of an individual untracked file).

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 22 in “Git commit won't add an untracked file given on the command line”
  1. Mark BurtonNov 18, 2008
  2. Francis GaliegueNov 18, 2008
  3. Mark BurtonNov 18, 2008
  4. Johannes SchindelinNov 19, 2008
  5. Miles BaderNov 19, 2008
  6. Johannes SchindelinNov 19, 2008
  7. Miles BaderNov 19, 2008
  8. Johannes SchindelinNov 19, 2008
  9. Miles BaderNov 20, 2008
  10. Junio C HamanoNov 19, 2008
  11. Mark BurtonNov 19, 2008
  12. Johannes SchindelinNov 19, 2008
  13. Junio C HamanoNov 19, 2008
  14. Mark BurtonNov 19, 2008
  15. Daniel BarkalowNov 19, 2008
  16. Junio C HamanoNov 19, 2008
  17. Mark BurtonNov 19, 2008
  18. Junio C HamanoNov 19, 2008
  19. Daniel BarkalowNov 19, 2008
  20. Junio C HamanoNov 20, 2008
  21. David AguilarNov 20, 2008
  22. Matthieu MoyNov 18, 2008

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.