From: Thomas Rast Date: Sat, 25 Jul 2009 21:29:33 GMT Subject: [RFC PATCH v3 4/5] Implement 'git checkout --patch' Message-ID: <93da49abd5fc514906bac73553d6802eb7fb69fd.1248557241.git.trast@student.ethz.ch> In-Reply-To: This introduces a --patch mode for git-checkout. In the index usage git checkout --patch -- [files...] it lets the user discard edits from the at the granularity of hunks (by selecting hunks from 'git diff' and then reverse applying them to the worktree). We also accept a revision argument git checkout --patch -- [files...] which offers hunks from the difference between the and the worktree. The chosen hunks are then reverse applied to both index and worktree, discarding them completely. This application is done "atomically" in the sense that we first check if the patch applies to the index (it should always apply to the worktree). If it does not, we give the user a choice to either abort or apply to the worktree anyway. Signed-off-by: Thomas Rast --- Documentation/git-checkout.txt | 13 ++++++++++- builtin-checkout.c | 19 +++++++++++++++ git-add--interactive.perl | 48 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index ad4b31e..26a5447 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -11,6 +11,7 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] [] 'git checkout' [-q] [-f] [-m] [-b ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=