5

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,?] 

when I enter "e" the file is loaded with both versions and my cursor is automatically placed in the editor. After making my changes and CTRL+S to save I can't exit. I've tried q, ESC, CTRL+X, wq, :wq, :x! nothing works but closing the file with the "x" but then I get:

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) 

2 Answers 2

11

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 "Your edited hunk does not apply" Then used the following when editing the patch:

  1. Save the file as with any other file CTRL+S
  2. CTRL+W, ENTER to exit after making the changes and return you to the terminal
Sign up to request clarification or add additional context in comments.

Comments

1

I just saved the changes in the editor and closed it. Fixation has taken place. Then synchronized the changes

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.