0

I have made a few commits to a branch and pushed it to remote. I want to make them into a single commit. How do I uncommit the previous few commits in a branch without effecting the files?

bittterbotter
  • 445
  • 6
  • 18

1 Answers1

1

If you had not pushed the commits to a remote branch, you could have used e.g. git rebase -i to squash the commits into one. See How can I merge two commits into one?

But as the commits are already pushed, there is no proper way instead of overwriting the history, which is usually a bad idea especially if others have already pulled your changes.

If you can do it, use git rebase as described above and then see Force "git push" to overwrite remote files .

Community
  • 1
  • 1
jofel
  • 3,297
  • 17
  • 31