{"thread":{"id":"63371","subject":"basics - auto staging?","startedAt":"2025-04-30T10:20:39Z","lastAt":"2025-04-30T16:44:07Z","messageCount":2,"participants":["Marcin Mikłas","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"517003","messageId":"10c9da5c-234c-4a40-bbff-91ba820dd970@wszib.edu.pl","threadId":"63371","inReplyTo":null,"subject":"basics - auto staging?","fromName":"Marcin Mikłas","fromEmail":"m.miklas@wszib.edu.pl","sentAt":"2025-04-30T10:18:24Z","receivedAt":"2025-04-30T10:20:39Z","isPatch":false,"sender":{"key":"m.miklas@wszib.edu.pl","avatar":null},"body":"Hello,\n\nwhen I execute\ngit commit file.txt\n(by listing file as argumentbut without the -a switch) for a file \nfile.txt that I have made changes without staged them in the index, the \nchanges are still commited.\nIs there a way to make this work like command\ngit commit\nwithout committing the changes that are not staged in the index?\n\nBest\nMarcin\n\n"},{"id":"517026","messageId":"xmqqbjsd38h7.fsf@gitster.g","threadId":"63371","inReplyTo":"10c9da5c-234c-4a40-bbff-91ba820dd970@wszib.edu.pl","subject":"Re: basics - auto staging?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-30T16:44:04Z","receivedAt":"2025-04-30T16:44:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcin Mikłas <m.miklas@wszib.edu.pl> writes:\n\n> when I execute\n> git commit file.txt\n> (by listing file as argumentbut without the -a switch) for a file\n> file.txt that I have made changes without staged them in the index,\n> the changes are still commited.\n> Is there a way to make this work like command\n> git commit\n> without committing the changes that are not staged in the index?\n\nI do not think there is.\n\nThe \"git commit --only [<pathspec>...]\" mode (which is the default)\nwas introduced as a variant whose blast radius is much smaller than\nthe \"git commit --include [<pathspec>...]\" mode (which was the only\nmode before \"--only\" was introduced), but what you seem to be after\nis a mode that is even finer-grained one.\n\nI do not offhand see a reason why such a mode should not exist.  It\nwould be called the \"git commit --cached [<pathspec>...]\" mode (that\nwould be listed next to the existing \"--only\" and \"--include\" modes\nin the documentation), by taking inspiration from the name of\nanother command \"git diff --cached [<pathspec>...]\" (i.e., use only\nthe contents already added to the index), if we were to add one.\n\n\n"}]}