Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Compare & Merge Branches with GitLens assist

There is some basic glitch in my understanding of VSCODE and GitLens.(and maybe I need remedial GIT training, oh well).

I am looking to merge a branch someone else created (and checked into BitBucket, so GitBucket PullRequest extension is not an option).

With GitLens I can visually compare branches. With VSCODE & GitLens I can interactively approve/deny each change that occur on the same branch where both of us modified and committed different changes (BTW, where is THAT useful. Does don't most developers create a different feature branch, and not have two developers changing a single branch at one time).

But how can I have the combination of effects, both working on separate feature branches, and then the ability to merge both branches? (not just overwrite with the new merge, but interactively see both changes and approve or disapprove or add both?), and keep all the blame annotation?

like image 980
Dr.YSG Avatar asked Jan 20 '26 03:01

Dr.YSG


1 Answers

The quick Git howto would be:

  1. First merge the other branch into yours: git merge [other branch]

  2. Fix any merge conflicts using the editor or a favorite diff tool.

  3. Commit the merge: git commit

Then periodically when you want to stay current with the other branch, repeat the process. But to keep it as merge-conflict seamless as possible, it's best your branch merges into the mainline. And that you repeat the steps above after they make their final commit to that branch and before you merge into the mainline. Or that they merge back into your branch and then you merge again back to the mainline if they make changes after you merged to mainline.

like image 180
benhorgen Avatar answered Jan 21 '26 23:01

benhorgen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!