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?
Asked
Active
Viewed 244 times
1 Answers
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 .