From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Branchaud Subject: [PATCHv3] Teach -f/--force-rebase option to 'rebase -i'. Date: Tue, 23 Mar 2010 12:19:47 -0400 Message-ID: <1269361187-31291-1-git-send-email-marcnarc@xiplink.com> References: <4BA8D263.8040602@xiplink.com> Cc: Johannes Sixt , Jonathan Nieder , Junio C Hamano , Marc Branchaud To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Mar 23 17:18:57 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Nu6ob-0004M4-En for gcvg-git-2@lo.gmane.org; Tue, 23 Mar 2010 17:18:50 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754968Ab0CWQRu (ORCPT ); Tue, 23 Mar 2010 12:17:50 -0400 Received: from 208-85-112-101.zerofail.com ([208.85.112.101]:45981 "EHLO farnsworth.xiplink.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754642Ab0CWQRt (ORCPT ); Tue, 23 Mar 2010 12:17:49 -0400 Received: from rincewind (rincewind.xiplink.com [192.168.1.136]) by farnsworth.xiplink.com (8.14.2/8.14.2/Debian-2build1) with ESMTP id o2NGHRFM005410; Tue, 23 Mar 2010 12:17:27 -0400 Received: by rincewind (Postfix, from userid 1000) id 9B60A33663F; Tue, 23 Mar 2010 12:20:02 -0400 (EDT) X-Mailer: git-send-email 1.7.0.3.dirty In-Reply-To: <4BA8D263.8040602@xiplink.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This option tells rebase--interactive to cherry-pick all the commits in the rebased branch, instead of fast-forwarding over any unchanged commits. Also expanded -f's description in rebase's man page. -f offers an alterntive way to deal with reverted merges. Instead of "reverting the revert" you can use "rebase -f [-i]" to recreate the branch with entirely new commits (they're new because at the very least the committer time is different). This obviates the need to revert the reversion, as you can re-merge the new topic branch directly. Added an addendum to revert-a-faulty-merge.txt describing the situation and how to use -f to handle it. Signed-off-by: Marc Branchaud --- It seems more natural to me to just teach -f to "rebase -i" instead of adding a new --no-ff option. This patch combines my initial "--no-ff" patch with the documentation changes in my "reword" patch. I moved the unit test for "rebase -f -i" into t3404-rebase-interactive.sh. M. Documentation/git-rebase.txt | 10 ++++- Documentation/howto/revert-a-faulty-merge.txt | 57 +++++++++++++++++++++++++ git-rebase--interactive.sh | 9 +++- t/t3404-rebase-interactive.sh | 36 ++++++++++++++-- 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 823f2a4..1fd8d1c 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -274,9 +274,15 @@ which makes little sense. -f:: --force-rebase:: Force the rebase even if the current branch is a descendant - of the commit you are rebasing onto. Normally the command will + of the commit you are rebasing onto. Normally non-interactive rebase will exit with the message "Current branch is up to date" in such a - situation. + situation. With --interactive, this option forces rebase to + cherry-pick all commits, even if they're not actually changed. ++ +--force-rebase can sometimes be helpful after reverting a topic branch merge, +as it recreates the topic branch with fresh commits so it can be remerged +successfully without needing to "revert the reversion" (see the +link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To]). --ignore-whitespace:: --whitespace=