Skip to content

Commit 0d7ffe2

Browse files
committed
Clarify suggestions to avoid unwanted file commits and unnecessary diffs
1 parent 4390a61 commit 0d7ffe2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/wiki-guide/Command-Line-Cheat-Sheet.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ See also [GitHub's Markdown Guide](https://docs.github.com/en/get-started/writin
3030
| `git branch -d <branch>` | delete branch |
3131

3232
!!! tip "Pro tip: Simplify your git history"
33-
- Use `git mv` to rename a file so that it is tracked as a rename (with or without changes). - If you rename a file then use `git add .` or similar, the diff will show the deletion of the original file and addition of a "completely new" file, even if nothing has changed. This makes reviewing changes much more complicated than necessary.
33+
- Use `git mv` to rename a file so that it is tracked as a rename (with or without changes).
34+
- If you rename a file then `git add` its parent directory, the diff will show the deletion of the original file and addition of a "completely new" file, even if nothing has changed. This makes reviewing changes much more complicated than necessary.
3435

3536
#### Usual Process
3637
After making changes to a file on a branch, check the status of your current working branch (with `git status`). Then, you "add" the file, state what is new about the file ("commit the change"), and `push` the file from your local copy of the repo to the remote copy:
@@ -44,6 +45,9 @@ git push
4445

4546
```
4647

48+
!!! tip "Pro tip: Check the stage"
49+
After using `git add <folder>` or `git add <regex>` (a pattern match), run `git status` to ensure that all intended files--and ***only*** intended files--are staged for commit.
50+
4751
!!! note Note
4852
If you need to update your branch with changes from the remote `main`, first switch to the branch, then set pull from `main` instead of the current branch, as below.
4953
```bash

0 commit comments

Comments
 (0)