0

I have a clean local repos with my last commit 10001, and I have pushed it to the github remote repos. But a colleague has pushed two more commits after mine, commit 10002 and 10003 . So the remote repos is two commits ahead of mine. How can I remove those two commits from the remote repos so that my last commit is the last one also in the remote repos? thanks

cplus
  • 1,115
  • 4
  • 22
  • 55

1 Answers1

0

If you want to overwrite those commits on the branch you can do git push --force to force your history to overwrite the remote history. This will completely remove your colleagues commits though so make sure this is what you want to do.

You might need to do git push - - force <remote> <branch> if you're not tracking the remote branch.

Possible duplicate of Overriding remote git repository with my repository

Community
  • 1
  • 1
Dan Purdy
  • 371
  • 2
  • 6