~sircmpwn/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
5 4

[PATCH git-rebase.io] Add a paragraph about 'git rebase --autosquash'

Denis Laxalde
Details
Message ID
<20201118092428.14516-1-denis.laxalde@dalibo.com>
DKIM signature
missing
Download raw message
Patch: +26 -0
From: Denis Laxalde <denis@laxalde.org>

---
Using git rebase regularly, git commit --fixup and git rebase --autosquash
really improve the user experience in my opinion. So, if it seems appropriate
to have this mentionned in the tutorial, here's a patch.

 index.html | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/index.html b/index.html
index 3be9b14..5e85c29 100644
--- a/index.html
+++ b/index.html
@@ -187,6 +187,32 @@ git commit -a -m"fixup greeting.txt"</pre>
        <pre>$ git log -2 --oneline
<span style="color: #A80">fcff6ae (</span><span style="color: blue">HEAD -&gt;</span> <span style="color: green">master</span><span style="color: #cc9000">)</span> Add farewell.txt
<span style="color: #A80">a479e94</span> Add greeting.txt</pre>

        <div class="tip">
          <p>
            <strong>Tip</strong>: the steps described above can also be
            performed in a more automated manner by taking advantage of the
            <code>--autosquash</code> option of <code>git rebase</code>:
          </p>
          <pre>git commit -a --fixup HEAD^
git rebase -i --autosquash HEAD~3</pre>
          <p>
            This will prepare the rebase plan with commits reordered and
            actions setup:
          </p>
          <pre><!--
--><span style="color: #A80">pick</span> <span style="color: #06c">8d3fc77</span> <span style="color: purple">Add greeting.txt</span>
<span style="color: #A80">fixup</span> <span style="color: #06c">0b9d0bb</span> <span style="color: purple">fixup! Add greeting.txt</span>
<span style="color: #A80">pick</span> <span style="color: #06c">2a73a77</span> <span style="color: purple">Add farewell.txt</span>

<span style="color: grey"># Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands)
#
# Commands:
# p, pick &lt;commit&gt; = use commit
# f, fixup &lt;commit&gt; = like "squash", but discard this commit's log message</span>
          </pre>
        </div>

        <h2 id="squash">Squashing several commits into one</h2>
        <p>
          As you work, you may find it useful to write lots of commits as you
-- 
2.20.1
Details
Message ID
<0jGkA8o-Bb2OZ45btVVgq9C331E9ovf3yWsC27hmEYuJHQKItYPuk-3D3ImSPezy5S8ioIt1jGE5SNHlgQLDTVU7a4EnSQ35c460kkRRQGQ=@emersion.fr>
In-Reply-To
<20201118092428.14516-1-denis.laxalde@dalibo.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
This can be configured as well:

    git config --global rebase.autosquash true

And then no need to manually pass --autosquash.
Details
Message ID
<074bff92-4876-d910-a979-388c0937afc1@laxalde.org>
In-Reply-To
<0jGkA8o-Bb2OZ45btVVgq9C331E9ovf3yWsC27hmEYuJHQKItYPuk-3D3ImSPezy5S8ioIt1jGE5SNHlgQLDTVU7a4EnSQ35c460kkRRQGQ=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
Simon Ser a écrit :
> This can be configured as well:
> 
>      git config --global rebase.autosquash true
> 
> And then no need to manually pass --autosquash.
> 

Yes, that and rebase.autostash.
Details
Message ID
<C76H20T8D0HB.13TUMMFUGYKZI@taiga>
In-Reply-To
<20201118092428.14516-1-denis.laxalde@dalibo.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
This is probably better as a dedicated section rather than a side note.

[PATCH git-rebase.io v2] Add a section about 'git rebase --autosquash'

Details
Message ID
<20201119084813.18886-1-denis@laxalde.org>
In-Reply-To
<20201118092428.14516-1-denis.laxalde@dalibo.com> (view parent)
DKIM signature
missing
Download raw message
Patch: +37 -0
From: Denis Laxalde <denis@laxalde.org>

---
 index.html | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/index.html b/index.html
index 3be9b14..f0c92d9 100644
--- a/index.html
+++ b/index.html
@@ -73,6 +73,7 @@
        <ol>
          <li><a href="#amending">Amending your last commit</a></li>
          <li><a href="#fixup">Fixing up older commits</a></li>
          <li><a href="#autosquash">Automating interactive rebase todo list</a></li>
          <li><a href="#squash">Squashing several commits into one</a></li>
          <li><a href="#edit">Splitting one commit into several</a></li>
          <li><a href="#reorder">Reordering commits</a></li>
@@ -187,6 +188,42 @@ git commit -a -m"fixup greeting.txt"</pre>
        <pre>$ git log -2 --oneline
<span style="color: #A80">fcff6ae (</span><span style="color: blue">HEAD -&gt;</span> <span style="color: green">master</span><span style="color: #cc9000">)</span> Add farewell.txt
<span style="color: #A80">a479e94</span> Add greeting.txt</pre>

        <h2 id="autosquash">Automating interactive rebase todo list</h2>
        <p>
          The steps described above can also be performed in a more automated
          manner by taking advantage of the <code>--autosquash</code> option
          of <code>git rebase</code> in combination with the
          <code>--fixup</code> option of <code>git commit</code>:
        </p>
        <pre>git commit -a --fixup HEAD^
git rebase -i --autosquash HEAD~3</pre>
        <p>
          This will prepare the rebase plan with commits reordered and
          actions set up:
        </p>
        <pre><!--
--><span style="color: #A80">pick</span> <span style="color: #06c">8d3fc77</span> <span style="color: purple">Add greeting.txt</span>
<span style="color: #A80">fixup</span> <span style="color: #06c">0b9d0bb</span> <span style="color: purple">fixup! Add greeting.txt</span>
<span style="color: #A80">pick</span> <span style="color: #06c">2a73a77</span> <span style="color: purple">Add farewell.txt</span>

<span style="color: grey"># Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands)
#
# Commands:
# p, pick &lt;commit&gt; = use commit
# f, fixup &lt;commit&gt; = like "squash", but discard this commit's log message</span>
        </pre>
        <p>
          In addition to <code>--fixup</code>, the <code>--squash</code>
          option for <code>git commit</code> also exists and will allow you to
          edit the commit message.
        </p>
        <p>
          Finally, the <code>--autosquash</code> option can be omitted by
          setting this behavior as the default through configuration:
        </p>
        <pre>git config --global rebase.autosquash true</pre>

        <h2 id="squash">Squashing several commits into one</h2>
        <p>
          As you work, you may find it useful to write lots of commits as you
-- 
2.20.1

Re: [PATCH git-rebase.io v2] Add a section about 'git rebase --autosquash'

Details
Message ID
<C79000IBYEWN.1H6IPJJGI8Q4P@taiga>
In-Reply-To
<20201119084813.18886-1-denis@laxalde.org> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/git-rebase.io
   9605c83..  master -> master
Reply to thread Export thread (mbox)