I'm trying to ammend a commit comment on a git commit, so I git commit --amend then vi opens with text from the last commit's comment. Then I delete all of the text on the first line, but I cannot remove the newline character, how can I do that?


J - Join two lines

  • @Erik: If it has worked, please click on the tick left to the answer. – whitequark Jun 6 '10 at 19:30
  • I had to wait 2mins ={ – erikvold Jun 6 '10 at 19:37
  • J doesn't seem to work here, my cursor just jumps to the next line – nmz787 Nov 3 '17 at 21:32
  • seems the correct usage is SHIFT+J – nmz787 Nov 3 '17 at 21:33

You can use dd to delete the whole current line, whether it is empty or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.