I have two branches say master and dev, I merged dev into master w/o merge request on git lab.
Problem: Now if I try to raise merge request on git lab from dev to master, it shows no difference.
Solution tried: I created one more branch from master and reverted the merge commit from that branch using
git revert -m
after doing this when I try to raise merge request on git lab it still says
There isn't anything to merge.
But I can see the difference when I try to compare the branches locally.
Please suggest
On the other hand, reverting a merge commit negates all the changes made by the branch of the specified parent. For instance if after reverting the merge commit(177a8b) in the feature branch, it were merged back to master, it would wipe out the changes (9745432 and b15b045) made in the master branch.
A revert adds another commit, you need to merge that commit into the relevant branches yourself. Revert cannot insert a commit into the history, nor change the original commit, so it affects the branches you want it to affect.
When you're done with a branch and it has been merged into master, delete it. A new branch can be made off of the most recent commit on the master branch. Also, while it is ok to hang onto branches after you've merged them into the master they will begin to pile up.
After the merge request has been merged, use the Revert button to revert the changes introduced by that merge request. After you select that button, a modal appears where you can choose to revert the changes directly into the selected branch or you can opt to create a new merge request with the revert changes.
If you look at the network tab in gitlab or git log you will see the revert is after the merge. Revert does not rewrite the history, it adds a new commit. Instead of doing a revert use git reset --hard <commit> to reset the master branch to state before the merge and then git push -f.
Well, yes, because it's already merged. If you look at the network tab in gitlab or git log you will see the revert is after the merge. Revert does not rewrite the history, it adds a new commit. Instead of doing a revert use git reset --hard <commit> to reset the master branch to state before the merge and then git push -f.
You can use Git’s powerful feature to revert any commit by clicking the Revert button in merge requests and commit details. The Revert button is shown only for projects that use the merge method “Merge Commit”, which can be set under the project’s Settings > General > Merge request.
Getting started with Git and GitLab. To compare branches in a repository: Navigate to your project’s repository. Select Repository > Compare in the sidebar. Select the target repository to compare with the repository filter search box . Select branches to compare using the branch filter search box . Click Compare to view the changes inline:
Well, yes, because it's already merged. If you look at the network tab in gitlab or git log you will see the revert is after the merge. Revert does not rewrite the history, it adds a new commit.
Instead of doing a revert use git reset --hard <commit>
to reset the master branch to state before the merge and then git push -f
.
Here is a LifeHack:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With