From: Thomas Rast Date: Sat, 15 Aug 2009 11:48:30 +0000 (+0200) Subject: Implement 'git checkout --patch' X-Git-Tag: v1.6.5-rc0~5^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4f353658b9c15e9188530fac5ae79d0aa1538e85;p=git.git Implement 'git checkout --patch' 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. In the case git checkout --patch HEAD -- [files...] we offer hunks from the difference between HEAD and the worktree, and reverse applies them to both index and worktree, allowing you to discard staged changes completely. In the non-HEAD usage git checkout --patch -- [files...] it offers hunks from the difference between the worktree and . The chosen hunks are then applied to both index and worktree. The application to worktree and index 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 Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index ad4b31e89..26a5447fb 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=