oliverdavies.uk/content/node.cc44360f-4d47-4899-9f3b-d4a88c4f7eca.yml

118 lines
4.7 KiB
YAML

uuid:
- value: cc44360f-4d47-4899-9f3b-d4a88c4f7eca
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:03+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: 'Local merging and squashing'
created:
- value: '2024-12-12T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:03+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2024/12/12/local-squashing
langcode: en
body:
- value: |
<p>Because <a href="/daily/2022/09/20/why-like-trunk-based-development">I do trunk-based development</a>, I typically don't create branches in Git.</p>
<p>If I do, I usually want to keep the commit messages, but there are some situations where I want to squash everything into a single commit with a simple message.</p>
<p>Typically, I'd do this using a rebase command like <code>git rebase -i main</code> and get an output like this, showing the commits:</p>
<pre><code class="plain">pick d21fafc Remove encrypted disk configuration
pick ffc1296 Update mount location for media directories
pick 58f645e Add multigrep from TJ's video
pick bbd5052 Revert "Remove encrypted disk configuration"
pick 8280c49 Show more generations on boot
pick d3b0c48 Revert "Add encrypted media drive"
pick 8cdc6a5 Add paperless-ngx
pick 73d801d Add Nick Janetakis' `notes` script
pick 99b6e3b Set options for text files
</code></pre>
<p>I can change <code>pick</code> to <code>squash</code> or <code>fixup</code> and decide what to do for each commit.</p>
<p><code>squash</code> combines the commit with the previous one, including the commit messages.</p>
<p><code>fixup</code> uses the previous commit message and discards the current one.</p>
<p>Once the file is saved, the rebase is performed and the actions are executed.</p>
<h2 id="there-is-another-way">There is another way</h2>
<p>If you don't want any of the commit messages, you can also use <code>git merge --squash</code>.</p>
<p>This will automatically squash all the commits - ready for you to run <code>git commit</code> and provide the final message.</p>
<p>There's no option to merge or combine the previous messages, though.</p>
<p>If you want to do that, you can still use the rebase approach.</p>
<p>If not, use <code>git merge --squash</code>.</p>
format: full_html
processed: |
<p>Because <a href="/daily/2022/09/20/why-like-trunk-based-development">I do trunk-based development</a>, I typically don't create branches in Git.</p>
<p>If I do, I usually want to keep the commit messages, but there are some situations where I want to squash everything into a single commit with a simple message.</p>
<p>Typically, I'd do this using a rebase command like <code>git rebase -i main</code> and get an output like this, showing the commits:</p>
<pre><code class="plain">pick d21fafc Remove encrypted disk configuration
pick ffc1296 Update mount location for media directories
pick 58f645e Add multigrep from TJ's video
pick bbd5052 Revert "Remove encrypted disk configuration"
pick 8280c49 Show more generations on boot
pick d3b0c48 Revert "Add encrypted media drive"
pick 8cdc6a5 Add paperless-ngx
pick 73d801d Add Nick Janetakis' `notes` script
pick 99b6e3b Set options for text files
</code></pre>
<p>I can change <code>pick</code> to <code>squash</code> or <code>fixup</code> and decide what to do for each commit.</p>
<p><code>squash</code> combines the commit with the previous one, including the commit messages.</p>
<p><code>fixup</code> uses the previous commit message and discards the current one.</p>
<p>Once the file is saved, the rebase is performed and the actions are executed.</p>
<h2 id="there-is-another-way">There is another way</h2>
<p>If you don't want any of the commit messages, you can also use <code>git merge --squash</code>.</p>
<p>This will automatically squash all the commits - ready for you to run <code>git commit</code> and provide the final message.</p>
<p>There's no option to merge or combine the previous messages, though.</p>
<p>If you want to do that, you can still use the rebase approach.</p>
<p>If not, use <code>git merge --squash</code>.</p>
summary: null
field_daily_email_cta: { }