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.
Solved! Solved! Go to Solution.
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:
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:
git reset --hard HEAD^
In order to achive item 3, you can execute:
git push --force
Any time you use `git push --force` though, you may cause problems for other people working on the same branch because you're rewriting history. So use it with caution as well.
I hope that helps!