ZBLOG

gitlab merge request how to make two branch keep some file diff

To keep a specific file different between two branches during a GitLab merge request, you can use the following steps:

  1. On both branches, make the necessary changes to the file you want to keep different.

  2. Create a new branch from one of the branches that contains the modified file.

  3. Merge the other branch into the new branch using the --no-commit option to avoid committing the changes.

git checkout -b new_branch <branch_that_contains_modified_file>
git merge --no-commit <other_branch>
  1. Resolve any conflicts that arise during the merge.

  2. Use git checkout --theirs and git checkout --ours commands to choose which version of the modified file to keep.

  3. Commit the changes and push the new branch to GitLab.

  4. Open a merge request on GitLab and select the new branch as the source branch and the target branch as the destination branch.

  5. In the merge request page, uncheck the box for the modified file under “Changes” to keep it different between the two branches.

  6. Complete the merge request and verify that the file is different between the two branches.

Note: It is recommended to only use this approach for specific cases where keeping a file different between branches is necessary. In most cases, it is better to keep all files consistent between branches to maintain code quality and ensure consistency.

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=979

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?