I have a master branch and a development branch both are in sync with each other currently.
I need to roll back my master branch to a prior commit (at least 30 commits back) so I can make a change and commit it. Then I would like to reapply everything and bring it back up to the current date in sync with development.
Can I do this by reverting master to a prior commit? Make the change, commit it, and then merge development into master. Would that work? Is there an easier or more appropriate way to do this?
Thanks in advance for your help!
There are a few different ways to do this: rebase
/cherry-pick
/reset
+merge
. It'll look something like this:
Before:
* C4 <- [master] [development]
* C3
* C2
* C1
reset master to C1, then commit Alteration A1:
* A1 <- [master]
| * C4 <- [development]
| * C3
| * C2
|/
* C1
Option 1: Bring up to date /w development (via merge):
* C5 <- [master]
|\
| * C4 <- [development]
| * C3
| * C2
* | A1
|/
* C1
Option 2: Bring up to date /w development (via rebase or cherry-pick):
* C4' <- [master] [development2]
* C3'
* C2'
* A1
| * C4 <- [development]
| * C3
| * C2
|/
* C1
But you should have a really good reason for rolling master
back and changing history -- it'll probably be better to just add more changes on top instead.
Perhaps you could provide some more details so a better/specific recommendation can be given?