# [PATCH] add configuration variable for --autosquash option of interactive rebase

11 messages from 2010-07-09 to 2010-07-14. Participants: Heiko Voigt, Andreas Schwab, Junio C Hamano, Santi Béjar, Stephen Boyd.
Thread: https://gitlist.dev/t/24347

## Heiko Voigt, 2010-07-09 12:47

Subject: [PATCH] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100709124659.GA17559@book.hvoigt.net>
URL: https://gitlist.dev/e/20100709124659.GA17559%40book.hvoigt.net

```
If you use this feature regularly you can now enable it by default.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 Documentation/git-rebase.txt |    3 +++
 git-rebase--interactive.sh   |    1 +
 t/t3415-rebase-autosquash.sh |   38 ++++++++++++++++++++++++++++++--------
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index be23ad2..8849758 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -199,6 +199,9 @@ rebase.stat::
 	Whether to show a diffstat of what changed upstream since the last
 	rebase. False by default.
 
+rebase.autosquash::
+	If set to true enable --autosquash option by default.
+
 OPTIONS
 -------
 <newbase>::
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6b86abc..54dc983 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -111,6 +111,7 @@ VERBOSE=
 OK_TO_SKIP_PRE_REBASE=
 REBASE_ROOT=
 AUTOSQUASH=
+test "$(git config --bool rebase.autosquash)" == "true" && AUTOSQUASH=t
 NEVER_FF=
 
 GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index b63f4e2..ccc5e44 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -21,38 +21,60 @@ test_expect_success setup '
 	git tag base
 '
 
-test_expect_success 'auto fixup' '
+test_auto_fixup() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "fixup! first"
 
-	git tag final-fixup &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-fixup &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto fixup (option)' '
+	test_auto_fixup final-fixup-option --autosquash
+'
+
+test_expect_success 'auto fixup (config)' '
+	git config rebase.autosquash true &&
+	test_auto_fixup final-fixup-config-true
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_fixup final-fixup-config-false
 '
 
-test_expect_success 'auto squash' '
+test_auto_squash() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "squash! first"
 
-	git tag final-squash &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-squash &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto squash (option)' '
+	test_auto_squash final-squash --autosquash
+'
+
+test_expect_success 'auto squash (config)' '
+	git config rebase.autosquash true &&
+	test_auto_squash final-squash-config-true
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_squash final-squash-config-false
 '
 
 test_expect_success 'misspelled auto squash' '
-- 
1.7.2.rc2.1.geb6d9

```

## Andreas Schwab, 2010-07-09 18:01

Subject: Re: [PATCH] add configuration variable for --autosquash option of interactive rebase
Message-ID: <m27hl4zg99.fsf@igel.home>
URL: https://gitlist.dev/e/m27hl4zg99.fsf%40igel.home
In-Reply-To: <20100709124659.GA17559@book.hvoigt.net>

```
Heiko Voigt <hvoigt@hvoigt.net> writes:

> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 6b86abc..54dc983 100755
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -111,6 +111,7 @@ VERBOSE=
>  OK_TO_SKIP_PRE_REBASE=
>  REBASE_ROOT=
>  AUTOSQUASH=
> +test "$(git config --bool rebase.autosquash)" == "true" && AUTOSQUASH=t

That should be '=' instead of '==' (which is non-std).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Heiko Voigt, 2010-07-10 09:15

Subject: [PATCH v2] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100710091517.GA27323@book.hvoigt.net>
URL: https://gitlist.dev/e/20100710091517.GA27323%40book.hvoigt.net
In-Reply-To: <m27hl4zg99.fsf@igel.home>

```
If you use this feature regularly you can now enable it by default.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---

On Fri, Jul 09, 2010 at 08:01:22PM +0200, Andreas Schwab wrote:
> Heiko Voigt <hvoigt@hvoigt.net> writes:
> 
> > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> > index 6b86abc..54dc983 100755
> > --- a/git-rebase--interactive.sh
> > +++ b/git-rebase--interactive.sh
> > @@ -111,6 +111,7 @@ VERBOSE=
> >  OK_TO_SKIP_PRE_REBASE=
> >  REBASE_ROOT=
> >  AUTOSQUASH=
> > +test "$(git config --bool rebase.autosquash)" == "true" && AUTOSQUASH=t
> 
> That should be '=' instead of '==' (which is non-std).

True, too much C these days.


 Documentation/git-rebase.txt |    3 +++
 git-rebase--interactive.sh   |    1 +
 t/t3415-rebase-autosquash.sh |   38 ++++++++++++++++++++++++++++++--------
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index be23ad2..8849758 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -199,6 +199,9 @@ rebase.stat::
 	Whether to show a diffstat of what changed upstream since the last
 	rebase. False by default.
 
+rebase.autosquash::
+	If set to true enable --autosquash option by default.
+
 OPTIONS
 -------
 <newbase>::
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6b86abc..6e181f4 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -111,6 +111,7 @@ VERBOSE=
 OK_TO_SKIP_PRE_REBASE=
 REBASE_ROOT=
 AUTOSQUASH=
+test "$(git config --bool rebase.autosquash)" = "true" && AUTOSQUASH=t
 NEVER_FF=
 
 GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index b63f4e2..ccc5e44 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -21,38 +21,60 @@ test_expect_success setup '
 	git tag base
 '
 
-test_expect_success 'auto fixup' '
+test_auto_fixup() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "fixup! first"
 
-	git tag final-fixup &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-fixup &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto fixup (option)' '
+	test_auto_fixup final-fixup-option --autosquash
+'
+
+test_expect_success 'auto fixup (config)' '
+	git config rebase.autosquash true &&
+	test_auto_fixup final-fixup-config-true
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_fixup final-fixup-config-false
 '
 
-test_expect_success 'auto squash' '
+test_auto_squash() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "squash! first"
 
-	git tag final-squash &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-squash &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto squash (option)' '
+	test_auto_squash final-squash --autosquash
+'
+
+test_expect_success 'auto squash (config)' '
+	git config rebase.autosquash true &&
+	test_auto_squash final-squash-config-true
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_squash final-squash-config-false
 '
 
 test_expect_success 'misspelled auto squash' '
-- 
1.7.2.rc2.1.geb6d9.dirty

```

## Junio C Hamano, 2010-07-12 05:55

Subject: Re: [PATCH v2] add configuration variable for --autosquash option of interactive rebase
Message-ID: <7vk4p1fdlg.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk4p1fdlg.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20100710091517.GA27323@book.hvoigt.net>

```
Heiko Voigt <hvoigt@hvoigt.net> writes:

> If you use this feature regularly you can now enable it by default.

And if you use this often _but_ you sometimes need to countermand from the
command line, do you provide a way to do so (I didn't bother to check).

```

## Heiko Voigt, 2010-07-13 11:24

Subject: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100713112316.GA758@book.hvoigt.net>
URL: https://gitlist.dev/e/20100713112316.GA758%40book.hvoigt.net
In-Reply-To: <7vk4p1fdlg.fsf@alter.siamese.dyndns.org>

```
If you use this feature regularly you can now enable it by default. In
case the user wants to override this config on the commandline
--no-autosquash can be used to force disabling.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
On Sun, Jul 11, 2010 at 10:55:55PM -0700, Junio C Hamano wrote:
> Heiko Voigt <hvoigt@hvoigt.net> writes:
> 
> > If you use this feature regularly you can now enable it by default.
> 
> And if you use this often _but_ you sometimes need to countermand from the
> command line, do you provide a way to do so (I didn't bother to check).

No I did not see the exact use case because you could simply not prefix
you commits with 'fixup!' or 'squash!' and if your project regularly
uses those on commits you probably would like to configure different
prefixes.

On the other hand I think it is a good convention to always provide a
--no-... option for things you can enable in the config and it does not
hurt to do so. So here is a new patch implementing this. I also fixed
some places with missing && in the testcases I implemented.

cheers Heiko

 Documentation/git-rebase.txt |    8 ++++++++
 git-rebase--interactive.sh   |    4 ++++
 t/t3415-rebase-autosquash.sh |   40 ++++++++++++++++++++++++++++++++--------
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index be23ad2..d357ab1 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -199,6 +199,9 @@ rebase.stat::
 	Whether to show a diffstat of what changed upstream since the last
 	rebase. False by default.
 
+rebase.autosquash::
+	If set to true enable '--autosquash' option by default.
+
 OPTIONS
 -------
 <newbase>::
@@ -335,6 +338,11 @@ idea unless you know what you are doing (see BUGS below).
 +
 This option is only valid when the '--interactive' option is used.
 
+--no-autosquash::
+	If the '--autosquash' option is enabled by default using the
+	configuration variable `rebase.autosquash` this option can be
+	used to override and disable this setting.
+
 --no-ff::
 	With --interactive, cherry-pick all rebased commits instead of
 	fast-forwarding over the unchanged ones.  This ensures that the
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6b86abc..7b35f80 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -111,6 +111,7 @@ VERBOSE=
 OK_TO_SKIP_PRE_REBASE=
 REBASE_ROOT=
 AUTOSQUASH=
+test "$(git config --bool rebase.autosquash)" = "true" && AUTOSQUASH=t
 NEVER_FF=
 
 GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
@@ -795,6 +796,9 @@ first and then run 'git rebase --continue' again."
 	--autosquash)
 		AUTOSQUASH=t
 		;;
+	--no-autosquash)
+		AUTOSQUASH=
+		;;
 	--onto)
 		shift
 		ONTO=$(parse_onto "$1") ||
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index b63f4e2..37cb89a 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -21,38 +21,62 @@ test_expect_success setup '
 	git tag base
 '
 
-test_expect_success 'auto fixup' '
+test_auto_fixup() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "fixup! first"
 
-	git tag final-fixup &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-fixup &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto fixup (option)' '
+	test_auto_fixup final-fixup-option --autosquash
+'
+
+test_expect_success 'auto fixup (config)' '
+	git config rebase.autosquash true &&
+	test_auto_fixup final-fixup-config-true &&
+	test_must_fail test_auto_fixup fixup-config-true-no --no-autosquash &&
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_fixup final-fixup-config-false
 '
 
-test_expect_success 'auto squash' '
+test_auto_squash() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "squash! first"
 
-	git tag final-squash &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-squash &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto squash (option)' '
+	test_auto_squash final-squash --autosquash
+'
+
+test_expect_success 'auto squash (config)' '
+	git config rebase.autosquash true &&
+	test_auto_squash final-squash-config-true &&
+	test_must_fail test_auto_squash squash-config-true-no --no-autosquash &&
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_squash final-squash-config-false
 '
 
 test_expect_success 'misspelled auto squash' '
-- 
1.7.2.rc2.1.gf1735.dirty

```

## Santi Béjar, 2010-07-13 12:34

Subject: Re: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <AANLkTilFOOK1eXkzWJXlr3zf78xZ82nIK9Jrr1END3-Y@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTilFOOK1eXkzWJXlr3zf78xZ82nIK9Jrr1END3-Y%40mail.gmail.com
In-Reply-To: <20100713112316.GA758@book.hvoigt.net>

```
On Tue, Jul 13, 2010 at 1:24 PM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> If you use this feature regularly you can now enable it by default. In
> case the user wants to override this config on the commandline
> --no-autosquash can be used to force disabling.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>

[...]

> @@ -335,6 +338,11 @@ idea unless you know what you are doing (see BUGS below).
>  +
>  This option is only valid when the '--interactive' option is used.
>
> +--no-autosquash::
> +       If the '--autosquash' option is enabled by default using the
> +       configuration variable `rebase.autosquash` this option can be
> +       used to override and disable this setting.
> +

You could also merge this entry with the --autosquash as with --squash
option in git-pull(1):

--autosquash::
--noautosquash::
[original text]
+
If the '--autosquash' option is enabled by default using the
configuration variable `rebase.autosquash` this option can be
used to override and disable this setting.

Santi

```

## Junio C Hamano, 2010-07-13 16:08

Subject: Re: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <7vlj9f4b5a.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vlj9f4b5a.fsf%40alter.siamese.dyndns.org
In-Reply-To: <AANLkTilFOOK1eXkzWJXlr3zf78xZ82nIK9Jrr1END3-Y@mail.gmail.com>

```
Santi Béjar <santi@agolina.net> writes:

> You could also merge this entry with the --autosquash as with --squash
> option in git-pull(1):
>
> --autosquash::
> --noautosquash::
> [original text]
> +
> If the '--autosquash' option is enabled by default using the
> configuration variable `rebase.autosquash` this option can be
> used to override and disable this setting.

Thanks for the suggestion; that probably reads better.

```

## Stephen Boyd, 2010-07-14 05:15

Subject: Re: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <4C3D4802.2010707@gmail.com>
URL: https://gitlist.dev/e/4C3D4802.2010707%40gmail.com
In-Reply-To: <20100713112316.GA758@book.hvoigt.net>

```
  On 07/13/2010 04:24 AM, Heiko Voigt wrote:
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index be23ad2..d357ab1 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -199,6 +199,9 @@ rebase.stat::
>   	Whether to show a diffstat of what changed upstream since the last
>   	rebase. False by default.
>
> +rebase.autosquash::
> +	If set to true enable '--autosquash' option by default.
> +

Can you squash this in too? I know we duplicate the wording, but rebase.stat has set some precedence here on that one.

---->8-------

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 79d54e5..9e3c48b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1533,6 +1533,9 @@ rebase.stat::
         Whether to show a diffstat of what changed upstream since the last
         rebase. False by default.

+rebase.autosquash::
+       If set to true enable '--autosquash' option by default.
+
  receive.autogc::
         By default, git-receive-pack will run "git-gc --auto" after
         receiving data from git-push and updating refs.  You can stop

```

## Heiko Voigt, 2010-07-14 11:50

Subject: Re: Re: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100714115003.GA15316@book.hvoigt.net>
URL: https://gitlist.dev/e/20100714115003.GA15316%40book.hvoigt.net
In-Reply-To: <7vlj9f4b5a.fsf@alter.siamese.dyndns.org>

```
Hi,

On Tue, Jul 13, 2010 at 09:08:49AM -0700, Junio C Hamano wrote:
> Santi Béjar <santi@agolina.net> writes:
> 
> > You could also merge this entry with the --autosquash as with --squash
> > option in git-pull(1):
> >
> > --autosquash::
> > --noautosquash::
> > [original text]
> > +
> > If the '--autosquash' option is enabled by default using the
> > configuration variable `rebase.autosquash` this option can be
> > used to override and disable this setting.
> 
> Thanks for the suggestion; that probably reads better.

Same from me. Will change the patch accordingly.

cheers Heiko

```

## Heiko Voigt, 2010-07-14 11:54

Subject: Re: Re: [PATCH v3] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100714115422.GB15316@book.hvoigt.net>
URL: https://gitlist.dev/e/20100714115422.GB15316%40book.hvoigt.net
In-Reply-To: <4C3D4802.2010707@gmail.com>

```
On Tue, Jul 13, 2010 at 10:15:46PM -0700, Stephen Boyd wrote:
> Can you squash this in too? I know we duplicate the wording, but rebase.stat has set some precedence here on that one.
>
> ---->8-------
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 79d54e5..9e3c48b 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1533,6 +1533,9 @@ rebase.stat::
>         Whether to show a diffstat of what changed upstream since the last
>         rebase. False by default.
>
> +rebase.autosquash::
> +       If set to true enable '--autosquash' option by default.
> +
>  receive.autogc::
>         By default, git-receive-pack will run "git-gc --auto" after
>         receiving data from git-push and updating refs.  You can stop

Thanks for noticing. Will do. I find it helpful to have an overview of
all configuration variables in one place.

cheers Heiko

```

## Heiko Voigt, 2010-07-14 11:59

Subject: [PATCH v4] add configuration variable for --autosquash option of interactive rebase
Message-ID: <20100714115957.GC15316@book.hvoigt.net>
URL: https://gitlist.dev/e/20100714115957.GC15316%40book.hvoigt.net
In-Reply-To: <4C3D4802.2010707@gmail.com>

```
If you use this feature regularly you can now enable it by default. In
case the user wants to override this config on the commandline
--no-autosquash can be used to force disabling.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---

Changes since v3:

  * Add documentation of configuration variable to config.txt
  * Merge description of --no-autosquash with the one of --autosquash

 Documentation/config.txt     |    3 +++
 Documentation/git-rebase.txt |    8 ++++++++
 git-rebase--interactive.sh   |    4 ++++
 t/t3415-rebase-autosquash.sh |   40 ++++++++++++++++++++++++++++++++--------
 4 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 72949e7..d0c985e 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1531,6 +1531,9 @@ rebase.stat::
 	Whether to show a diffstat of what changed upstream since the last
 	rebase. False by default.
 
+rebase.autosquash::
+	If set to true enable '--autosquash' option by default.
+
 receive.autogc::
 	By default, git-receive-pack will run "git-gc --auto" after
 	receiving data from git-push and updating refs.  You can stop
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index be23ad2..1e2a564 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -199,6 +199,9 @@ rebase.stat::
 	Whether to show a diffstat of what changed upstream since the last
 	rebase. False by default.
 
+rebase.autosquash::
+	If set to true enable '--autosquash' option by default.
+
 OPTIONS
 -------
 <newbase>::
@@ -326,6 +329,7 @@ idea unless you know what you are doing (see BUGS below).
 	instead.
 
 --autosquash::
+--no-autosquash::
 	When the commit log message begins with "squash! ..." (or
 	"fixup! ..."), and there is a commit whose title begins with
 	the same ..., automatically modify the todo list of rebase -i
@@ -334,6 +338,10 @@ idea unless you know what you are doing (see BUGS below).
 	commit from `pick` to `squash` (or `fixup`).
 +
 This option is only valid when the '--interactive' option is used.
++
+If the '--autosquash' option is enabled by default using the
+configuration variable `rebase.autosquash` this option can be
+used to override and disable this setting.
 
 --no-ff::
 	With --interactive, cherry-pick all rebased commits instead of
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6b86abc..7b35f80 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -111,6 +111,7 @@ VERBOSE=
 OK_TO_SKIP_PRE_REBASE=
 REBASE_ROOT=
 AUTOSQUASH=
+test "$(git config --bool rebase.autosquash)" = "true" && AUTOSQUASH=t
 NEVER_FF=
 
 GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
@@ -795,6 +796,9 @@ first and then run 'git rebase --continue' again."
 	--autosquash)
 		AUTOSQUASH=t
 		;;
+	--no-autosquash)
+		AUTOSQUASH=
+		;;
 	--onto)
 		shift
 		ONTO=$(parse_onto "$1") ||
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index b63f4e2..37cb89a 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -21,38 +21,62 @@ test_expect_success setup '
 	git tag base
 '
 
-test_expect_success 'auto fixup' '
+test_auto_fixup() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "fixup! first"
 
-	git tag final-fixup &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-fixup &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto fixup (option)' '
+	test_auto_fixup final-fixup-option --autosquash
+'
+
+test_expect_success 'auto fixup (config)' '
+	git config rebase.autosquash true &&
+	test_auto_fixup final-fixup-config-true &&
+	test_must_fail test_auto_fixup fixup-config-true-no --no-autosquash &&
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_fixup final-fixup-config-false
 '
 
-test_expect_success 'auto squash' '
+test_auto_squash() {
 	git reset --hard base &&
 	echo 1 >file1 &&
 	git add -u &&
 	test_tick &&
 	git commit -m "squash! first"
 
-	git tag final-squash &&
+	git tag $1 &&
 	test_tick &&
-	git rebase --autosquash -i HEAD^^^ &&
+	git rebase $2 -i HEAD^^^ &&
 	git log --oneline >actual &&
 	test 3 = $(wc -l <actual) &&
-	git diff --exit-code final-squash &&
+	git diff --exit-code $1 &&
 	test 1 = "$(git cat-file blob HEAD^:file1)" &&
 	test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'auto squash (option)' '
+	test_auto_squash final-squash --autosquash
+'
+
+test_expect_success 'auto squash (config)' '
+	git config rebase.autosquash true &&
+	test_auto_squash final-squash-config-true &&
+	test_must_fail test_auto_squash squash-config-true-no --no-autosquash &&
+	git config rebase.autosquash false &&
+	test_must_fail test_auto_squash final-squash-config-false
 '
 
 test_expect_success 'misspelled auto squash' '
-- 
1.7.2.rc2.1.gf1735.dirty

```
