How to compare different branches on Visual studio code

匿名 (未验证) 提交于 2019-12-03 01:17:01

问题:

How to compare different branches on Visual studio code 1.9? Is it possible?

回答1:

I would recommend to use: Git Lens.



回答2:

UPDATE

Now it's available:

https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory

until now it isn't supported, but can follow the thread for it: github



回答3:

Use Git History Diff plugin for easy side-by-side branch diffing:

https://marketplace.visualstudio.com/items?itemName=huizhou.githd

Visit the link above and scroll down to the animated gif titled Diff Branch. You'll see you can easily pick any branch and do side-by-side comparison with the branch you are on! It is like getting a preview of what you will see in the Github Pull Request. For other Git stuff I prefer VSCode's built-in functionality or Git Lens as others have mentioned. However, the above plugin is outstanding for doing branch diffing (ie. for those doing a rebase Git flow and need to preview before a force push up to a Github PR).



回答4:

It's now possible by using githistory extension.

Here's a small trick though: You can compare latest commits from each branch and that would be the same as comparing two branches side by side or creating PR.

Here's how to do that using githistory extension:

  1. Open githistory
  2. Pick the latest commit from your current branch by clicking on "Git Commit Icon" -> (Usually it should be latest commit it the list). From the opened dropdown menu click on "Select this commit".
  3. Pick the latest commit from the branch you want to compare to by clicking "Git Commit Icon".
  4. As a result, dropdown should appear with few options -> Select the last option that says "Compare with SHA" and you'll see the diff.

Hope that helps.



回答5:

I don't use Microsoft Visual Code, I'm using Microsoft Visual Studio (the community version is also free for non-commercial purposes). However, even in this IDE, I haven't figured out how to identify all the differences between two different branches. But you can look at the differences for a specific object in two different commits.

Until I find how to do it in Microsoft Visual Studio, I just use my favorite git GUI to identify all the differences between two commits (within the same branch, or in two different branches). I assume you could just do the same for Microsoft Visual Code.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!