Vscode: Git: Support git history in VSCode

Created on 18 Nov 2015  路  32Comments  路  Source: microsoft/vscode

It would be awesome to be able to squash commits right from the UI too

feature-request git

Most helpful comment

It would be great if we could right click a file and see the Git history for the file. If anyone knows of a nice OS X client that will allow me to easily find a file and view the history then let me know! I've found out how to do it on SourceTree but it's way too fiddly, and GitHub for Mac doesn't have such a feature.

All 32 comments

It would be great if we could right click a file and see the Git history for the file. If anyone knows of a nice OS X client that will allow me to easily find a file and view the history then let me know! I've found out how to do it on SourceTree but it's way too fiddly, and GitHub for Mac doesn't have such a feature.

@massimocode just wondering would an action to open the file on github and then view the history there cover your needs? For example there is an open in github extension https://marketplace.visualstudio.com/items/ziyasal.vscode-open-in-github

@egamma that works, but vscode's diff is waaaaaaaaay better than github :) Also, it would be awesome to stay inside vscode to do that

@egamma Hey Erich, thanks for the reply. Unfortunately we're not using GitHub, we're using Stash. It would be great if VSCode has inbuilt support for viewing source control history, like Visual Studio, although I can appreciate it would be a large effort!

It also enables viewing history offline, which is great and leverages one of the main benefits of distributed source control.

Valid points CC @chrisdias

How about an interactive history view, something like git extentions (http://gitextensions.github.io/ ) would be cool!

There is now a git history extension available that you can try: https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory

Yeah, has seen that one before, but its functionality is too limited.

@egamma Thanks this extension is exactly what I was looking for!

the extension is definitely better than nothing, but it's really is more like a makeshift solution. I still use SmartGit's log:

for history tracking. It would be cool if VSCode would steal get something comparable - with a separate interface and functionality to revert, blame, see what's in the other branches without actually switching them...

@massimocode , the githistory extension https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory now supports:

  • Viewing history by right clicking on a file in the explorer
  • Graphical view of git history

Will update it some time soon with a few more features.
Image

Is there any way using that extension (or any other extension available) to view the diff between two branches? When there's a long commit history with a lot of different contributors and various branches, it's very tedious to go find out which commit corresponds to a given branch, and then scroll through the commit history to find that commit. Even when commit messages shown, it's difficult to keep track which commit is the latest on a given branch.

This git command is very simple and straightforward and does exactly what I want:

  1. git diff origin/master HEAD
  2. git diff my-feature-branch (diffs against current working copy)
  3. git diff origin/release-branch-1.2.3 origin/release-branch-1.2.4
  4. git diff f38ab2e
  5. git diff f38ab2e df09c47
  6. git diff (between working copy and HEAD)

Unfortunately, the output in the command line is difficult to read and navigate through, so I would love to have the above functionality but be able to view it in VSCode's diff. I find VSCode's diff output to be easy to read, but right now it seems to be limited to only option 6 above. The Git History extension allows me to perform option 4 and 5 above as well, but that is still very limited, as I have to know which commits I want to compare (and the only way to compare a branch is to go separately find out the latest commit on that branch). Perhaps there is a way to do what I want in the extension and I just haven't found that functionality, but I don't know because documentation for the extension is almost non-existent. If anyone here knows how you can compare branches using the extension (or another existing extension) I would love to know.

Currently, my only workaround is to also open my local repo in IntelliJ (since it has built-in functionality to compare any branches or commits) while working in VSCode, so I have to have two IDEs open at once. Given that this functionality is already built into Git with the straightforward git diff command, I'm surprised that there isn't already a VSCode extension built on it that simply renders the diff command output in the VSCode diff.

I see there is no longer anyone assigned to this feature-request. Is it still being considered?

Yes, it's still open. 馃憤

@DonJayamanne: Does your extension also allow for a more concise visual style that is more suited for for a desktop system?

In general: Has someone considered porting gitk? I'd say it pretty much provides all the features one needs but I don't know how easy it would be to integrate it into VSCode / make a VSCode extension out of it.

So the conversation here rather quickly went from squashing to log inspection. This, however, is the first VSCode hit in a search for 'vscode git squash'. Is there any discussion of that somewhere else?

Is this the right issue for adding a git diff tool for different branches? I see it mentioned here, and I see other threads (#20222) closed with a reference to this issue, though the issue itself seems to just be about history. I would love a diff tool for two branches, I've had a lot of unexpected behavior from merging in the past, where there are no conflicts but code actually gets spliced in weird ways, and want to see all the differences that will be merged, and perhaps handle conflicts preemptively, before actually running the merge.

I have added some preliminary (needs a lot of polishing) support for diff between commits (branches) in the latest release.
Also making use of the new treeview (explorer) to display the commit information.
Image of Compare

@MikeGitb

@DonJayamanne: Does your extension also allow for a more concise visual style that is more suited for for a desktop system?

Sorry, the answer is no. You might want to try other tools such as GitKraken (this too is built on topp of Electron, just like VS Code) or the like.

It was actually this extension that gave me what I was looking for:
https://marketplace.visualstudio.com/items?itemName=huizhou.githd

@JacobJT Side-by-side Git Diff between branches:
screen shot 2017-09-13 at 8 54 23 am

Check out this extension, it's everything I wanted in a merge compare tool https://marketplace.visualstudio.com/items?itemName=letmaik.git-tree-compare#review-details

in gitlab, we can see branch's commits list
if we click one commit, then we can see what is changed(there is view side-by-side).

is there same functionality in gitlens?

thanks in advance

Having moved from Windows to Mac, Git Extensions is the one thing I miss every day. If VS Code could replicate that experience it would make my day.

@starcraft0429 this is a late response, but yes, GitLens extension has side by side view (July 2018)

https://github.com/eamodio/vscode-gitlens/#powerful-comparison-tools

When comparing two branches, it lists the files with diffs. You can then select the individual files and see a side by side comparison between the branches.

Steps to take:

  1. Click GitLens icon (to the left)
  2. Open branches node in Explorer Tree.
  3. right-click a branch > Select For Compare
  4. right-click another branch > Compare With Selected

In the RESULTS section, there will be a node with # files changed. You can a listed file and get a side-by-side diff.

Sublime merge (https://www.sublimemerge.com/) was just released and it a view that could be nicely integrated into vscode.

screen shot 2018-09-24 at 17 53 51

What I really like in this screenshot is the history on the left. At a a glance I can see other branches, how many files have been edited in each commit, and what has been pushed. I think that adding a simple history view like this would be a powerful addititon to VSCode.

What do people think? Would adding a view like this with some basic options on right click be what you want for this feature request?

For anyone looking for an alternative / workaround - I'll repeat what a few people have said so far: try the GitLens extension. It adds a significant amount of extra functionality and I use it constantly while working.

Alternatives are not a problem, but i think its should be native option.
If VS Code offers git, it should offer all important git options (in fact git log that is)

I also think that vs code really need to support this option. For most cases it's the only missing option in vs code git support, and there's no good plugin to do this thing. Since VS code already have git support, it makes sense to add history as well. Looking forward to uninstall source tree from my workstation.

https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph looks like git history

Great plugin! Thank you. Finally it鈥檚 time to uninstall sourcetree. Would be great to have it out of the box in vs code. Git log is a vital thing and since vs code supports git, history should be supported too IMO. It鈥檚 integrity.

The Timeline preview in 1.42 is relevant to this issue.

https://code.visualstudio.com/updates/v1_42#_timeline-view

Was this page helpful?
0 / 5 - 0 ratings

Related issues

borekb picture borekb  路  3Comments

sijad picture sijad  路  3Comments

lukehoban picture lukehoban  路  3Comments

villiv picture villiv  路  3Comments

shanalikhan picture shanalikhan  路  3Comments