1
我知道git checkout .
是git宇宙中最危险的命令之一(正确如此)。有没有办法让它互动?就像rm
命令与-i
选项一样。git checkout。(dot)interactive
我要找沿
git checkout . -i
我知道git checkout .
是git宇宙中最危险的命令之一(正确如此)。有没有办法让它互动?就像rm
命令与-i
选项一样。git checkout。(dot)interactive
我要找沿
git checkout . -i
git checkout
东西线(和git add
以及)支持-p
选项,它会问你的每一个大块头,像这样:
diff --git a/post.so b/post.so
index b111bdd..ddba6b1 100644
--- a/post.so
+++ b/post.so
@@ -1 +1,3 @@
-`git checkout` (and `git add` as well) support the `-p` option.
+`git checkout` (and `git add` as well) support the `-p` option, which will ask you for every hunk, like this:
+
+foo bar
Discard this hunk from worktree [y,n,q,a,d,/,e,?]?
对于每一个大块你可以回答:
y - discard this hunk from worktree
n - do not discard this hunk from worktree
q - quit; do not discard this hunk or any of the remaining ones
a - discard this hunk and all later hunks in the file
d - do not discard 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
? - print help