From 5f167a7c89214f3654c8165a32ce8082b8468084 Mon Sep 17 00:00:00 2001 From: Jonathan Agmon Date: Thu, 14 May 2026 20:04:01 +0300 Subject: [PATCH] update add -p --- git/add.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/git/add.md b/git/add.md index 050b7c4..922d407 100644 --- a/git/add.md +++ b/git/add.md @@ -27,13 +27,20 @@ Cons: Sometimes split won't work, which will force you to use the -e method. #### Guidelines - Run `git add -p ` or `git add -p` to go through patch hunks interactively. - For each hunk, choose: - - `y` to stage this hunk - - `n` to leave it unstaged - - `s` to split the hunk into smaller parts - - `e` to edit the hunk manually - - `q` to quit and leave remaining hunks unstaged - - `a` to stage this hunk and all remaining hunks - - `d` to leave this hunk and all remaining hunks unstaged + - `y` to stage the hunk + - `n` to not stage the hunk + - `q` to quit; do not stage the hunk or any remaining ones + - `a` to stage the hunk and all later hunks in the file + - `d` to not stage the hunk or any later hunks in the file + - `g` to select a hunk to go to + - `/` to search for a hunk matching the given regex + - `j` to go to the next hunk + - `J` to go to the previous hunk + - `k` to go to the previous hunk + - `K` to go to the previous undecided hunk + - `s` to split the current hunk into smaller ones + - `e` to manually edit the current hunk + - `?` to print help - If you choose `s`, Git will attempt to split the hunk into smaller hunks so you can stage a smaller section. -- If you choose `e`, Git opens the patch in a temporary editor; delete `+` or `-` lines you do NOT want staged, then save and close. -- When finished, run `git status` to verify which hunks were staged. \ No newline at end of file +- If you choose `e`, Git opens the patch in a temporary editor; delete `+` lines you do NOT want staged and convert `-` lines to spaces to prevent staging their deletion, then save and close. +- When finished, run `git status` to verify which hunks were staged.