Skip to content

Commit 4390a61

Browse files
committed
Add tip on renaming files tracked with git
1 parent 7ddb995 commit 4390a61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
See also [GitHub's Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
44

5-
## Useful bash, emacs, and git:
5+
## Useful bash and git
66
| Command | Action |
77
| --- | --- |
88
| `<cmd> -h` | print the help documentation for a command, showing usage information and options |
@@ -29,6 +29,9 @@ See also [GitHub's Markdown Guide](https://docs.github.com/en/get-started/writin
2929
| `git checkout <branch>` | checkout branch |
3030
| `git branch -d <branch>` | delete branch |
3131

32+
!!! 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.
34+
3235
#### Usual Process
3336
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:
3437

0 commit comments

Comments
 (0)