summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-08-15 11:48:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-15 22:18:05 (GMT)
commit4f353658b9c15e9188530fac5ae79d0aa1538e85 (patch)
treec65622dc13e452b85cb31f54b6d54497e862aafb /git-stash.sh
parentd002ef4d9446b9fe4d0c397131edce58781df2f1 (diff)
downloadgit-4f353658b9c15e9188530fac5ae79d0aa1538e85.zip
git-4f353658b9c15e9188530fac5ae79d0aa1538e85.tar.gz
git-4f353658b9c15e9188530fac5ae79d0aa1538e85.tar.bz2
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 <files> 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 <revision> -- [files...] it offers hunks from the difference between the worktree and <revision>. 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 <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
0 files changed, 0 insertions, 0 deletions