Is there a way to see git diff from origin/master using Visual Studio Code?

前端 未结 5 1945
感动是毒
感动是毒 2021-01-31 13:41

Using Visual Studio Code (version 1.11.2), I can see a side-by-side graphical diff of my current changes very easily by clicking the Source Control button in the left p

相关标签:
5条回答
  • 2021-01-31 13:49

    From Using Version Control in Visual Studio Code:

    Add this to the Git configuration file, like ~/.gitconfig:

    [diff]
        tool = vscode
    [difftool "vscode"]
        cmd = code --wait --diff $LOCAL $REMOTE
    

    When using git difftool HEAD HEAD^, Git will ask if to use Visual Studio Code.

    0 讨论(0)
  • 2021-01-31 14:02

    It doesn't use Visual Studio Code, but if you just want to see a quick summary of changes... just start a PR from the branch on GitHub.

    0 讨论(0)
  • 2021-01-31 14:05

    I use GitLens extension as well. Go to Source Control tab, right click on file you want to compare with origin/master (or other) branch. From the menu choose Open Changes with... and pick a branch.

    0 讨论(0)
  • 2021-01-31 14:08

    You can use an extension for this.

    Two good options:

    Gitlens: https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens

    With this one, you can use the >GitLens: Open Changes with... action to compare with any branch (local or remote).

    You also can use Git History: https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory

    You can see the entire file history and compare with the current version with the >Git: View File History action.

    0 讨论(0)
  • 2021-01-31 14:10

    From MSDN blog

    Viewing Diffs

    Our Git tooling supports viewing of Diffs within VS Code. Click the file in the Git view to display a side-by-side view. This allows you to compare your current file with a previous version of it:

    0 讨论(0)
提交回复
热议问题