Add daily email for 2024-10-25
Always review your changes
This commit is contained in:
parent
83ad934402
commit
22e8e6c7a6
29
source/_daily_emails/2024-10-25.md
Normal file
29
source/_daily_emails/2024-10-25.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Always review your changes
|
||||
date: 2024-10-25
|
||||
permalink: daily/2024/10/25/always-review-your-changes
|
||||
tags:
|
||||
- software-development
|
||||
- git
|
||||
cta: ~
|
||||
snippet: |
|
||||
Always review your staged changes before committing.
|
||||
---
|
||||
|
||||
[In yesterday's email][0] where I wrote about `git stash`, I mentioned the `-p` or `--patch` options.
|
||||
|
||||
When stashing changes, this allows you to interactively select which changes you want to stash and what you don't.
|
||||
|
||||
This is supported by other Git commands, including `git add`.
|
||||
|
||||
I always use `git add -p` when adding changes as it gives me the chance to review them before committing them.
|
||||
|
||||
If I left any stray comments, debug code, trailing spaces or anything I don't want to commit, I can remove them.
|
||||
|
||||
If I was working on multiple changes (which I avoid), I can select the appropriate changes and create commits related to each change to keep the history clean and useful.
|
||||
|
||||
I also use `git diff` and `git diff --staged` to review changes as well as `git show` to review commits.
|
||||
|
||||
By doing this, I know my commits will be in the best state for others to review now or for me to review if I need to in the future.
|
||||
|
||||
[0]: {{site.url}}/daily/2024/10/24/git-stash-is-underrated
|
Loading…
Reference in a new issue