13

I'm trying to following the instructions on https://help.github.com/articles/using-git-rebase-on-the-command-line/ for interactively rebasing from my initial commit (More specifically, I'm trying to remove all the bin and obj folders from the history). So once I type in

git rebase -i --root

I get the following screen as expected, but then I can't figure out how to change the first one to edit. Like I can't figure out which button on the keyboard to click. Sorry if this is a stupid question.

enter image description here

2
  • Check out the basic VIM commands, video tutorials are pretty handy. Commented Mar 31, 2017 at 7:43
  • probably this should be useful to you Commented Mar 31, 2017 at 11:25

2 Answers 2

13

Thats pretty easy. You have to change the word pick to edit Then you save the file, in your case press ESC and then type :wq. Then git will start the rebase and you will stop on each commit you want to edit.

Edit: If you don't know how to insert in vim: press ESC and then i after that you are in insert-mode and as soon as you are finished with typing press ESC again and save it as described above.

Sign up to request clarification or add additional context in comments.

1 Comment

I think the OP may be in the same camp as I was; I had no idea this screen was vim. That hint alone is of great help!
-1

I faced a problem in doing squash commit on my Windows CMD and wanted to reproduce the steps I used to do squash commit on my Windows CMD as I felt the previous answer is not a complete guide on doing squash commit in Windows CMD.

Squashing commits into a single commit:

  1. git rebase -i HEAD~(Enter number of commits to be squashed)
  2. Press "i" to insert
  3. Now replace 'pick' with 's' for all unwanted commit messages
  4. Press Esc and then type ":wq"
  5. The above will open a new console. Remove all the unwanted commit lines
  6. Press Esc and then type ":wq" again

Your squash has now been completed.

Now the final step is to push the branch again with the command:-

git push origin (branch-name) -f

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.