Reputation: 387
Can I move the head of a remote repository to an earlier commit without creating a revert commit? Meaning that after this operation there will be less commits in the remote.
Just to clarify, this is what I am not interested in:
Possible or not?
Upvotes: 1
Views: 532
Reputation: 527448
Sure:
git push origin <sha>:HEAD
Will set the remote repository's HEAD
to point at <sha>
. In general, git push
can accept any sort of source:destination
style refspec, so you can for instance change what arbitrary remote branches refer to as well:
git push origin master:deploy
This would set the remote deploy
branch to point at the same commit as the local master
branch.
Upvotes: 2