Circumstance: When I tried to revert a big change in a branch with huge codes, it got conflict and reverting gets stopped at conflicted files, no continue to revert remaining files.
Solution: Then I tried another way to revert, it follows the below steps:
git reset --soft HEAD~ all of commits that need to revert. Then create a temple commit including all changes (it can use git rebase too, but for sure in every commits, I used git reset --soft)
git revert HEAD to create a revert commit for temple commit above.
git reset --soft HEAD~ to make the change of revert commit (in step 2) to be uncommitted stage.
git stash the change.
delete and checkout to restore git branch for getting back the original stage (remote branch)
git stash pop then makes a commit with revert changes.
git reset --soft HEAD~
all of commits that need to revert. Then createa temple commit
including all changes (it can usegit rebase
too, but for sure in every commits, I usedgit reset --soft
)git revert HEAD
to create a revert commit fortemple commit
above.git reset --soft HEAD~
to make the change of revert commit (in step 2) to be uncommitted stage.git stash
the change.git stash pop
then makes a commit with revert changes.