git status gives me this:
Your branch is behind ‘origin/network’ by 11 commits, and can be fast-forwarded.
This is because I reset to an earlier version (hoping to discard all I had done after).
However, if I try to push that version (or that version with some minor changes) this is not working.
I do not want the new stuff, I just want to start new with the old version I reverted to!
What do I do?
Since you’ve already pushed the “future” code, you want to avoid rewriting history at all costs if you have other contributors. You would introduce pretty severe updating nightmares.
If you know that nobody else has pulled the newest code, you can do the following to “recreate” the branch at a specific point. The following rewrites the history of your
networkbranch.If you don’t want to rewrite history (you should always avoid rewriting push-ed history), you can ‘revert’ the last 11 commits on the
networkbranch.The following is done while on the
HEADof yournetworkbranch.This effectively creates commits which ‘revert’ existing commits. Though where you might find yourself in trouble on this is if you merge this branch into another branch later and wanted to preserve your existing 11 commits for the merged branch.
See: the answer for Revert Multiple git commits.
You could also revert the 11 commits in one commit.