What is best way to revert commit? #22346
-
I have all sources of project but main.cpp in one directory and main.cpp in another directory. This caused problem with Doxygen to document all files, and I moved all but main() from main.cpp to another file. Next I commit and push to github. But my doxygened source are in one branch, I want merge to doxygen branch from other branches and I must revert commit to merge. My revert must not only make me previous source state, but also delete commit history to do correct merge. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are a bunch of different ways to revert a commit, depending on what the desired end result is. It sounds like you want to:
🚨 WARNING 🚨 Executing these commands will lose history (though Git does its best to make even that recoverable). Use these commands with caution. In order to achieve items 1 and 2, you can execute:
In order to achive item 3, you can execute:
Any time you use I hope that helps! |
Beta Was this translation helpful? Give feedback.
There are a bunch of different ways to revert a commit, depending on what the desired end result is. It sounds like you want to:
origin
remote to the local state of the current branch🚨 WARNING 🚨
Executing these commands will lose history (though Git does its best to make even that recoverable). Use these commands with caution.
In order to achieve items 1 and 2, you can execute:
In order to achive item 3, you can execute:
Any time you use
git push --force
thou…