correct add -e
This commit is contained in:
12
git/add.md
12
git/add.md
@@ -9,11 +9,15 @@ Cons: More manual work, you have to edit the patch file yourself, which can be e
|
||||
- `+` lines: additions in the working tree (will be staged if kept).
|
||||
- `-` lines: deletions in the working tree (will be staged if kept).
|
||||
- Context lines (no prefix): unchanged lines needed for patch context.
|
||||
- To stage a change: keep the `+` or `-` line in the patch.
|
||||
- To NOT stage a change: **delete** the `+` or `-` line from the patch.
|
||||
- To stage an addition: keep the `+` line in the patch.
|
||||
- To NOT stage an addition: **delete** the `+` line from the patch.
|
||||
- To stage a deletion: keep the `-` line in the patch.
|
||||
- To NOT stage a deletion: **convert the `-` to a space**.
|
||||
- For modified content (shown with `-` lines followed by `+` lines):
|
||||
- To NOT stage the modification: convert the `-` lines to spaces and remove the `+` lines.
|
||||
- Note: modifying only half of the pair may cause confusing changes to the index.
|
||||
- To keep a line unchanged: leave context lines as-is.
|
||||
- **Never change `+` or `-` to spaces or vice versa** — this breaks the patch format and causes "patch does not apply" errors.
|
||||
- **To remove an added line (`+`) from being staged, delete the entire line.**
|
||||
- If you want to decline the operation entirely, delete all lines of the patch.
|
||||
- If you break the patch, run `git checkout -- <file>` to undo, then run `git add -e` again.
|
||||
## Git Add Hunks
|
||||
### `git add -p`
|
||||
|
||||
Reference in New Issue
Block a user