【问题标题】:VSCode Git exit & save commit editor?VSCode Git 退出并保存提交编辑器?
【发布时间】:2021-04-14 19:27:24
【问题描述】:

我在 Windows 10 上安装了 Git Bash,我正在关注此视频 https://youtu.be/MIFQwHlEI9o?t=602 在 VSCode 中使用 git,他正在使用带有 -p 选项的结帐从提交中挑选片段:

$ 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”时,文件会加载两个版本,并且我的光标会自动放置在编辑器中。进行更改并按 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)

【问题讨论】:

    标签: git visual-studio-code


    【解决方案1】:

    我终于想通了,我按照 Microsoft 的 Git 补丁/差异模式指南 https://vscode-docs.readthedocs.io/en/latest/editor/versioncontrol/ 和这个 stackoverflow 帖子正确编辑大块:git add --interactive "Your edited hunk does not apply" 然后在编辑补丁时使用以下内容:

    1. 将文件与任何其他文件一样保存 CTRL+S
    2. CTRL+W, ENTER 进行更改后退出并返回终端

    【讨论】:

      猜你喜欢
      • 2017-11-12
      • 1970-01-01
      • 2019-10-11
      • 1970-01-01
      • 2020-10-15
      • 2011-01-08
      • 2012-06-05
      • 2011-11-08
      相关资源
      最近更新 更多