I have the following screen and need the necessary commands to merge 2 commits.

- 23,757
- 20
- 73
- 115

- 19
-
3Learn how to use [vim](http://www.vim.org/) or configure `git` to use a different text editor. – melpomene Nov 07 '17 at 14:26
2 Answers
You are in the middle of an interactive rebase, and Git has placed you in the Vim editor so you can interactively tell Git the actions to take.
You should either learn the basics of Vim, or configure Git to use a different editor.
But for now, basically you want to replace the second "pick" with the text "squash" so the two commits are combined into one.
Steps:
- Press Escape to ensure you are in "command mode"
- Press j to go down to the second line
- Press x a few times until the "pick" word is removed
- Press i to enter "insert mode" and type the text "squash"
- Press Escape to get out of "insert mode" and back to "command mode"
- Type
:wq
to exit the Vim editor
You have now finished the rebase.

- 23,757
- 20
- 73
- 115
-
Command mode is the default. After pressing `j` (or just the "down arrow" cursor key), you can then type `cw` ("change word") to delete "pick" under the cursor and place you in insert mode. Type `s` (no need to type out "squash" in full) and press Esc. Then type `:x` followed by Enter to save and exit. – melpomene Nov 07 '17 at 14:31
-
Command mode is the default, but it's a good idea to start with an escape just in case the OP had accidentally entered another mode. I considered using `cw` for this, but I wanted to keep things as basic and clear as possible. – Jonathan.Brink Nov 07 '17 at 14:33
-
thank you so much :)) I was stuck in that screen for a half an hour but now it works – elad Nov 07 '17 at 14:53
You should press Escape, then enter :cq
(that's : (colon),
then c q, followed by Enter).
Now you will have left the vi editor, which is a fine editor, but has a bit of a learning curve.
Instead, go install GitPad, which will set up notepad as the text editor for Git.
Then you can run your rebase command again and you should be placed in the familiar notepad editor. (Now, I concede the notepad is a bit of a mediocre editor, but there's no reason to have to learn a decades old Unix text editor while you're trying to learn a merely decade old Unix version control system.)
Once notepad opens, follow the instructions that it gives you - in this case, changing the second line from pick
to fixup
(or perhaps squash
) is probably the right thing.

- 74,857
- 14
- 158
- 187