![]() The -no-edit flag specified to just keep the same commit message. This last command overwrote the current commit (which happens to be the merge commit) using -amend, rather than making a new commit, and because our original commit's file state was in place, git replaced the merge commit's files with our previous commit's files. Now, let's amend the merge commit so it has our original set of files: git commit -amend -no-edit These changes are our original commit's files, exactly as we want them! ![]() Now, if we run git status, we will see that there are staged changes. Now, let's bring back that commit ( 12345abc in this example), without changing the contents of our files, so that our files stay in the same state just as we desire: git reset 12345abc -soft That merge commit is still stored in git's internal history. see git log), we will see that we undid the merge commit and went back to our previous commit. This brings our branch to exactly the same state we started in. Now we will reset our current-branch back to our previous commit from before the merge, so that we get the files back into the state we want: git reset HEAD~ -hard To see the history and copy the hash of the merge commit. Now let's get the commit hash of this new merge commit. Git commit # conclude the merge, don't worry about conflict markers So if we have a conflict, just commit it anyway: git add every thing This assumes we are on current-branch and will merge branch-to-merge into our current branch ( current-branch).Īt this point, if we get a merge conflict, just commit everything including the conflicts without fixing them, it won't matter. After that I only want to "merge" integration on master without to put changes (because already are there). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |