Reputation: 8386
I've made some commits and then reverted them. How do I revert the revert? (After my revert there are other commits on the branch). If I remerge my branch into master I get already updated
because it already includes all of those commits I suppose.
* b1e0603 - other commit
* f835cec - Revert ""
* 68ffc84 - Revert ""
* da5795b - Revert ""
* 75ae2a0 - Revert ""
* 4e51f8f - Merge branch 'master'
|\
| * 58a6fe8 - commit
* | 205f2a2 - Merge branch 'on this branch are my commits that weere reverted'
|\ \
| |/
|/|
| * 425d6f3 - commit
* | 0efc0e9 - Merge branch 'on this branch are my commits that weere reverted'
Doing git revert 75ae2a0
ouputs conflicts. And there are like 10 reverts that I have to run. Should I just revert the merge (205f2a2)?
Thanks!
Upvotes: 2
Views: 744
Reputation: 9386
Summarizing the discussion above, as you did not push your changes you can re-write you changes with git reset/revert (depends on your specific case).
You can find some great tutorials about your options here in Atlassian Git Tutorials, and specifically in chapters Undoing Changes that discuss your options with git checkout, reset and revert commands, and Reset, Checkout, and Revert that discusses these command both in commit level and file level.
One recommendation, though - as some of these commands are irreversible I'd recommend you to make a backup of your repo and current commits so in case something will get wrong you will have a backup of your changes.
Upvotes: 1