commit 0284437acb66a3856a8a63b4648a7ac5d5f23881
parent ce324200c37835624c2c83e016d718b9d679de0b
Author: pyratebeard <root@pyratebeard.net>
Date: Mon, 9 Jun 2025 10:40:31 +0100
updates
Diffstat:
1 file changed, 30 insertions(+), 0 deletions(-)
diff --git a/programming/git.md b/programming/git.md
@@ -53,6 +53,36 @@ compare diff between two commits
git diff <commit>...<commit>
```
+compare file diff between two branches
+```
+git diff newbranch main -- file.txt
+git diff newbranch..main -- file.txt
+```
+using the latter syntax, if either side is `HEAD` it may be ommitted (e.g., `main..` compares `main` to `HEAD`)
+
+adding separate hunks from file
+```
+git add --patch <filename>
+git add -p <filename>
+```
+
+options:
+ * `y` stage this hunk for the next commit
+ * `n` do not stage this hunk for the next commit
+ * `q` quit; do not stage this hunk or any of the remaining hunks
+ * `a` stage this hunk and all later hunks in the file
+ * `d` do not stage this hunk or any of the later hunks in the file
+ * `g` select a hunk to go to
+ * `/` search for a hunk matching the given regex
+ * `j` leave this hunk undecided, see next undecided hunk
+ * `J` leave this hunk undecided, see next hunk
+ * `k` leave this hunk undecided, see previous undecided hunk
+ * `K` leave this hunk undecided, see previous hunk
+ * `s` split the current hunk into smaller hunks
+ * `e` manually edit the current hunk
+ * You can then edit the hunk manually by replacing `+`/`-` by `#`
+ * `?` print hunk help
+
stash
```
git stash