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

git-apply --reject

From
Junio C Hamano <junkio@cox.net>
Date
Aug 27, 2006, 23:03 UTC
Message-ID
<7vac5pvl0z.fsf@assigned-by-dhcp.cox.net>

The git-apply program in "next" has had a few additional options for some time: --reject and --verbose. I've been using this after a failed "git am" attempt:

	git apply --reject --verbose .dotest/patch

This, instead of the usual "patch does not apply so I would not touch any of your working tree files" behaviour, applies hunks that are applicable and leaves *.rej files the rejected hunks, and it reports what it is doing. With --index, files with a rejected hunk do not get their index entries updated at all, so "git diff" will show the hunks that successfully got applied.

This seems to be working rather nicely, so I intend to make it graduate to "master". I made a mistake of adding the man page that already talks about these options to "master", but with an incorrect the description for --reject (earlier I planned to send the rejected hunks to stdout which is still what the documentation describes), so the documentation will be updated accordingly.

I initially made --reject without --verbose not talk about anything that applied cleanly, but as the above example usage shows, I find myself always using --verbose when using --reject. Without --verbose to remind the user that the patch updated some other paths cleanly, it is very easy to lose track of the status of the working tree. So I'll make the final adjustment to make it imply --verbose before pushing it out.

Message 1 of 1 in “git-apply --reject”
  1. Junio C HamanoAug 27, 2006

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.