[PATCH 2/4] git-rebase: add keep_empty flag
- From
Neil Horman <nhorman@tuxdriver.com>
- Date
- Mar 30, 2012, 19:48 UTC
- Message-ID
- <1333136922-12872-3-git-send-email-nhorman@tuxdriver.com>
- In-Reply-To
- <1333136922-12872-1-git-send-email-nhorman@tuxdriver.com>
Add a command line switch to git-rebase to allow a user the ability to specify that they want to keep any commits in a series that are empty.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Jeff King <peff@peff.net> CC: Phil Hord <phil.hord@gmail.com> CC: Junio C Hamano <gitster@pobox.com> --- Documentation/git-rebase.txt | 6 ++++++ git-rebase.sh | 5 +++++ 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 504945c..9717d3e 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -238,6 +238,12 @@ leave out at most one of A and B, in which case it defaults to HEAD. will be reset to where it was when the rebase operation was started. +--keep-empty:: + Informs git-rebase that comits which are empty should not be + automatically removed. This is at times useful when empty commits + are used to hold developer information and notes, but contain no real + code changes + --skip:: Restart the rebasing process by skipping the current patch. diff --git a/git-rebase.sh b/git-rebase.sh index 69c1374..24a2840 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -43,6 +43,7 @@ s,strategy=! use the given merge strategy no-ff! cherry-pick all commits, even if unchanged m,merge! use merging strategies to rebase i,interactive! let the user edit the list of commits to rebase +k,keep-empty preserve empty commits during rebase f,force-rebase! force rebase even if branch is up to date X,strategy-option=! pass the argument through to the merge strategy stat! display a diffstat of what changed upstream @@ -97,6 +98,7 @@ state_dir= action= preserve_merges= autosquash= +keep_empty= test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t read_basic_state () { @@ -220,6 +222,9 @@ do -i) interactive_rebase=explicit ;; + -k) + keep_empty=yes + ;; -p) preserve_merges=t test -z "$interactive_rebase" && interactive_rebase=implied
-- 1.7.7.6