I made a mistake when using git:
#In master, which has commits like a-b-c#
git push origin master
git checkout -b branch2
# Now I'm in the branch2, and I did:
git reset --hard a
# work...
git commit ...
# work...
git commit ...
# so, now I have commits in branch2: a-d-e
If I go back to master and merge branch2, it will be something like a-b-c-d-e. However, any thing in commits b
and c
are completely garbage that I don't want.
How can I make remote repo to be a-d-e
? (The remote's master already has a-b-c
since I did a push before branching to branch2) I really don't want to mess up the repo, will git push origin master --force
be a good option?
Edit: After goolging git revert
, I found this question worth reading