villaways.blogg.se

Revert to master git
Revert to master git











revert to master git revert to master git

All you have to do is to check out the working tree for master into your develop branch and commit that state onto the develop branch. In your case, since you have another branch which has the exact (working directory) state you want to put your develop branch into, it is a lot easier to do that. Then, when you’re done selecting all commits or commit ranges you want to undo, you can make a single commit that combines them all. This allows you to chain multiple git revert -n commands after another without creating a reverting commit for each. You can also use the flag -no-commit, or -n, to not automatically create a commit. Given that you only have two ranges you would want to undo (those between those hotfixes), this would be actually manageable. In order to undo multiple commits at once, you can also specify a commit range. So you get a new commit that undoes all the changes. This command basically takes the inversed diff of a target commit and tries to apply it. The standard process to undo commits in a non-destructive way is to use git revert. Some other commits that are only in developĬommit hotfix1 - in both develop and masterĪll commits that came when develop was created from master So history of commits on develop looks something like this (most top means latest commit by date): commit hotfix2 - in both develop and master Maybe there is safer way to do this using revert or some other means? But I want to revert (if possible) in a way that would revert to master state, not manually selecting every commit, because some latest commits need to be kept in develop because they came from master (hotfixes). So to reset, I can do: git checkout developīut the problem is develop branch is already pushed to remote and there others that had pulled develop already. I saw this: Git: reset/revert a whole branch to another branches state? To preserve all changes that happened into develop, I will create new branch from develop so all those changes won't be lost.īut after doing "copy" of develop, how can I safely reset or revert to look like master? Though I need to make develop branch look exactly the same as master. There are lots of commits in develop that are not in master yet.













Revert to master git