118 lines
4.5 KiB
YAML
118 lines
4.5 KiB
YAML
uuid:
|
|
- value: 0c1ee324-e522-440a-85bf-e91847091ec9
|
|
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:14+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: 'Interactive staging'
|
|
created:
|
|
- value: '2024-05-06T00:00:00+00:00'
|
|
changed:
|
|
- value: '2025-05-11T09:00:14+00:00'
|
|
promote:
|
|
- value: false
|
|
sticky:
|
|
- value: false
|
|
default_langcode:
|
|
- value: true
|
|
revision_translation_affected:
|
|
- value: true
|
|
path:
|
|
- alias: /daily/2024/05/06/interactive-staging
|
|
langcode: en
|
|
body:
|
|
- value: |
|
|
<p>A major addition to my Git workflow has been the ability to interactively add hunks of code to be committed.</p>
|
|
|
|
<p>There's <code>git add -i</code> to interactively add, though I usually go straight to <code>git add -p</code> to use <code>patch</code>.</p>
|
|
|
|
<p>This will ask you to confirm if you want to add each hunk to the commit (a.k.a. the staging area) or not.</p>
|
|
|
|
<p>For example, here's the prompt I get whilst working on the post for this email:</p>
|
|
|
|
<pre><code class="shell">diff --git a/source/_daily_emails/2024-05-06.md b/source/_daily_emails/2024-05-06.md
|
|
index 42fe48f..ef36a2b 100644
|
|
--- a/source/_daily_emails/2024-05-06.md
|
|
+++ b/source/_daily_emails/2024-05-06.md
|
|
@@ -4,10 +4,12 @@ date: 2024-05-06
|
|
permalink: daily/2024/05/06/interactive-staging
|
|
tags:
|
|
- software-development
|
|
- # - drupal
|
|
- # - php
|
|
- # - podcast
|
|
+ - git
|
|
cta: ~
|
|
snippet: |
|
|
TODO
|
|
--- +
|
|
+A major addition to my Git workflow has been the ability to interactively add hunks of code to be committed.
|
|
+
|
|
+There's `git add -i` to interactively add, though I usually go straight to `git add -p` to use `patch`.
|
|
+There's `git add -i` to interactively add, though I usually go straight to `git add -p` to use `patch`.
|
|
(1/1) Stage this hunk [y,n,q,a,d,s,e,?]?
|
|
</code></pre>
|
|
|
|
<p>I can add the whole hunk, split it into smaller hunks, add all the hunks in the file or ignore this hunk and later hunks in the file.</p>
|
|
|
|
<p>Then the process is repeated for any following hunks.</p>
|
|
|
|
<p>This means I can add the relevant hunks to craft the commit I want and I can keep my commits small and meaningful, and easy to revert if there is an issue.</p>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p>A major addition to my Git workflow has been the ability to interactively add hunks of code to be committed.</p>
|
|
|
|
<p>There's <code>git add -i</code> to interactively add, though I usually go straight to <code>git add -p</code> to use <code>patch</code>.</p>
|
|
|
|
<p>This will ask you to confirm if you want to add each hunk to the commit (a.k.a. the staging area) or not.</p>
|
|
|
|
<p>For example, here's the prompt I get whilst working on the post for this email:</p>
|
|
|
|
<pre><code class="shell">diff --git a/source/_daily_emails/2024-05-06.md b/source/_daily_emails/2024-05-06.md
|
|
index 42fe48f..ef36a2b 100644
|
|
--- a/source/_daily_emails/2024-05-06.md
|
|
+++ b/source/_daily_emails/2024-05-06.md
|
|
@@ -4,10 +4,12 @@ date: 2024-05-06
|
|
permalink: daily/2024/05/06/interactive-staging
|
|
tags:
|
|
- software-development
|
|
- # - drupal
|
|
- # - php
|
|
- # - podcast
|
|
+ - git
|
|
cta: ~
|
|
snippet: |
|
|
TODO
|
|
--- +
|
|
+A major addition to my Git workflow has been the ability to interactively add hunks of code to be committed.
|
|
+
|
|
+There's `git add -i` to interactively add, though I usually go straight to `git add -p` to use `patch`.
|
|
+There's `git add -i` to interactively add, though I usually go straight to `git add -p` to use `patch`.
|
|
(1/1) Stage this hunk [y,n,q,a,d,s,e,?]?
|
|
</code></pre>
|
|
|
|
<p>I can add the whole hunk, split it into smaller hunks, add all the hunks in the file or ignore this hunk and later hunks in the file.</p>
|
|
|
|
<p>Then the process is repeated for any following hunks.</p>
|
|
|
|
<p>This means I can add the relevant hunks to craft the commit I want and I can keep my commits small and meaningful, and easy to revert if there is an issue.</p>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|