I have a weird setup with Git. Basically I have:
[client 1] <---> [remote repo] ----> [client 2]
[Client 1] is essentially the local repo I am working with, because I can’t compile/build the project on my local machine.
[Client 2] is a remote server for building.
In the middle, I have another repo, [remote repo], basically for synchronizing with a cvs central repo in my company, and also synchronizing between my [client 1] and [client 2].
Since all the compiling/building is done on [client 2], I have many trivial commits on [client 1] just for fixing the compilation or building errors.
So by the time I find out there are errors in the last commit, it’s already too late because the commit has already been pushed to and pulled from the remote repo.
How can I squash these (many) trivial commits into one?
Thanks.
First of all, avoid squashing and in general rewriting history unless you absolutely have to. Having “trivial” commits is not reason to squash pushed commits. If they can stay, let them stay. And rewriting history is not straightforward in cvs at all, so since these commits would have made their way into the cvs repo, you should probably live with it.
For the git remote repo, if you do wish to proceed – I assume you know to squash the commits on your local repo (
git rebase -iis straightforward). After the squash, push with a-f– a force push.