1

I made a lot of little commits and now I want to get rid of them all from the history so that if I do git log it only shows one commit at most. But I don't want to lose any of the changes I made. So basically my last commit becomes like the initial commit. How can I do that?

1 Answer 1

5

git rebase -i and mark all commits (except the first one) with s, that means squash. All commits will be squashed into one.

Note, that by doing this, you are rewriting history, and if this is a public repository, it will affect anyone who already pulled from the repo.

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

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.