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

Re: [Q] Mark files for later commit?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 29, 2011, 07:09 UTC
Message-ID
<4D91858F.7030404@drmicha.warpmail.net>
In-Reply-To
<7voc4uto9o.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 29.03.2011 08:49:
Show 29 quoted lines
> Daniel Nyström <daniel.nystrom@timeterminal.se> writes:
> 
>> So this makes me wonder, is there a way to mark certain files for
>> being committed later on? Which does not automatically get added to
>> the staging area (on "git commit -a" or "git add ." and so on) unless
>> it's specifically mentioned by "git add"?
>>
>> We've discussed making it generated automatically, but that's not as
>> easy as it may sound.
>>
>> How would you like a git feature like described above, marking files
>> for later inclusion?
> 
> That does not sound like a feature but merely a source of confusion.
> 
> So far, "commit -a", "add", "add ." etc have _all_ been a way to tell git
> to add the current state of the content to the index.  What is the point
> of making it more complex by letting the user say "I am telling you to add
> everything in the working tree by explicitly saying 'git add .', but I do
> not really mean it"?
> 
> In the meantime, some misguided souls might suggest assume-unchanged, but
> that is not guaranteed to work for this purpose, so ignore them.  This is
> because assume-unchanged is a promise you make git that you will _not_
> change the working tree files, and that promise implies a permission for
> git to use blob object recorded in the index that corresponds to such a
> path instead of reading from the working tree files while doing certain
> operations (such as "git diff") if it is more convenient.
> 

While I've used assume-unchanged before, it really is a great foot-gun (to shoot yourself into...) to be used only when circumstances force you.

In your case, if you really can't use shortlog or the like, a "light" way of generating a changelog might be using notes. Attach changelog notes to each commit (maybe in refs/notes/changelog rather than the standard). Then, when you need to create the changelog between vX and vY, you can do

git log --pretty="%N%n" vX..vY

(and go wild on the pretty format, of course). Note that you can share notes when you set up refspecs etc in a push/pull based workflow. (I'm not sure how well we support merging/pulling notes refs yet.) This does not work well in a patch/e-mail-based workflow.

Michael
Previous: Junio C HamanoNext: Johan Herland
Message 3 of 9 in “[Q] Mark files for later commit?”
  1. Daniel NyströmMar 29, 2011
  2. Junio C HamanoMar 29, 2011
  3. Michael J GruberMar 29, 2011
  4. Johan HerlandMar 29, 2011
  5. Michael J GruberMar 29, 2011
  6. Junio C HamanoMar 29, 2011
  7. Daniel NyströmMar 29, 2011
  8. Michael J GruberMar 29, 2011
  9. Daniel NyströmMar 29, 2011

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.