Re: git commit -p with file arguments
- From
Jakub Narębski <jnareb@gmail.com>
- Date
- Sep 10, 2016, 09:52 UTC
- Message-ID
- <b9d63103-011a-9486-2fa1-dcf3a82cbe64@gmail.com>
- In-Reply-To
- <87inu4bxt7.fsf@juno.home.vuxu.org>
W dniu 09.09.2016 o 22:52, Christian Neukirchen napisał:
Show 14 quoted lines
> Jakub Narębski <jnareb@gmail.com> writes: > >> Which means that with "git add -p <pathspec> && git commit <pathspec>", >> the "git add -p <pathspec>" would carefully craft the <pathspec> state >> in the index... and "git commit <pathspec>" would take worktree version >> of <pathspec> for commit, ignoring what was in the index :-( >> >> Currently there is no way to create commit out of subset of the index, >> e.g. with "git commit :0:<path>" > > I played around with creating a new index just for "add -p" and then > committing that one. Seems to have worked... > > Perhaps I'll just wrap git-commit myself then.
What I wanted to say is that there is no built-in way to create commit out of subset of the index. You can of course do what "git commit <file>" does, that is use temporary index file (GIT_INDEX_FILE etc.; see contrib/examples/git-commit.sh).
I wonder, if git-commit is to acquire such feature, what would be the best interface. "git commit :0:./<path>"? "git commit -o -p <path>" (that is, "git commit --only --patch <pathspec>")?
-- Jakub Narębski