![]() ![]() So with that we should get all the changes we reverted in this new branch, then we can add new changes to this branch and fix if something is needed and finally merge back to master. Next, run the following command to revert your repository to that verson: git reset -hard b0168ee This is quite easy, and gives you a lot of control over which version you recover. For example, if I wanted to revert to ‘Minor CSS tweaks’, I’d select the ID b0168ee. This option specifies the parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent. Select the version you want to revert to. Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline. Where 3rd line is crucial (find the hash of merge commit), this lines reverts the revert merge we made, "m" option is an mainline parent number, or as it says in docs Running this command will open an editor containing the existing commit message. git revert -m 1 37dsd67a48ed2fs1119c184ac7815fc8f3a7967c1 ApThe Problem In Git, how do I modify the commit message for a commit I’ve made but not yet pushed to a remote The Solution We can use git commit -amend to edit the latest commit message. git commit -mA git checkout -b thebranch edit test.txt git commit -a -mB git checkout master git merge master thebranch -no-ff edit test. git checkout master git merge hello-world-images Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed fix conflicts. So HEAD now contains both the merge request and the revert, hence why it thinks there is nothing to merge. 16 You can use rebase to do that in one step: git rebase -onto A C D I just tested this, with appropriate results: edit test.txt git add. Reverting does not roll back, but rather appends the revert to the front of the HEAD. So you made a mistake and made a revert, then you want to introduce again the code you use in new merge, if you try to make merge request(MR) from branch you made original MR you reverted you will get nothing in that MR. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |