[英]VSCode Git exit & save commit editor?
I have Git Bash installed on Windows 10, I'm following this video https://youtu.be/MIFQwHlEI9o?t=602 on using git inside VSCode, he's picking pieces from a commit using checkout with the -p option:
$ git checkout 0903304 index.html -p
diff --git b/index.html a/index.html
index 3ebbb46..d95bb1a 100644
--- b/index.html
+++ a/index.html
@@ -10,6 +10,10 @@
<ul>
<li>Item one</li>
</ul>
+
+ <p>Paragraph one</p>
+ <h1>A title</h1>
+ <div><p>Some text</p></div>
</body>
</html>
\ No newline at end of file
Apply this hunk to index and worktree [y,n,q,a,d,e,?]
當我輸入“e”時,文件會加載兩個版本,我的 cursor 會自動放置在編輯器中。 進行更改並按 CTRL+S 保存后,我無法退出。 我試過 q, ESC, CTRL+X, wq, :wq, :x: 除了用 "x" 關閉文件之外沒有任何作用,但后來我得到:
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]? 0 [sig] bash 987! sigpacket::process: Suppressing signal 18 to win32 process (pid 6340)
I finally figured this out, I followed the Microsoft guide for Git patch/diff mode https://vscode-docs.readthedocs.io/en/latest/editor/versioncontrol/ and this stackoverflow post for correctly editing the hunk: git add - -interactive "您編輯的塊不適用"然后在編輯補丁時使用以下內容:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.