From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Rast Subject: [RFC PATCH v3 4/5] Implement 'git checkout --patch' Date: Sat, 25 Jul 2009 23:29:33 +0200 Message-ID: <93da49abd5fc514906bac73553d6802eb7fb69fd.1248557241.git.trast@student.ethz.ch> References: <7vzlat64u1.fsf@alter.siamese.dyndns.org> Cc: Junio C Hamano , Pierre Habouzit , Nanako Shiraishi To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sat Jul 25 23:30:11 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1MUooi-00037K-A4 for gcvg-git-2@gmane.org; Sat, 25 Jul 2009 23:30:08 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753073AbZGYVaB (ORCPT ); Sat, 25 Jul 2009 17:30:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752856AbZGYVaA (ORCPT ); Sat, 25 Jul 2009 17:30:00 -0400 Received: from xsmtp0.ethz.ch ([82.130.70.14]:9118 "EHLO XSMTP0.ethz.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752946AbZGYV3s (ORCPT ); Sat, 25 Jul 2009 17:29:48 -0400 Received: from xfe2.d.ethz.ch ([82.130.124.42]) by XSMTP0.ethz.ch with Microsoft SMTPSVC(6.0.3790.3959); Sat, 25 Jul 2009 23:29:45 +0200 Received: from localhost.localdomain ([77.56.221.170]) by xfe2.d.ethz.ch over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Sat, 25 Jul 2009 23:29:44 +0200 X-Mailer: git-send-email 1.6.4.rc2.227.gf5e17 In-Reply-To: X-OriginalArrivalTime: 25 Jul 2009 21:29:44.0842 (UTC) FILETIME=[074BCEA0:01CA0D6F] Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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=