vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Git: Support git history in VSCode

Open luisrudge opened this issue 11 years ago • 35 comments

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

luisrudge avatar Nov 18 '15 17:11 luisrudge

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 avatar Dec 21 '15 11:12 massimocode

@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 avatar Dec 21 '15 20:12 egamma

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

luisrudge avatar Dec 22 '15 04:12 luisrudge

@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.

massimocode avatar Dec 22 '15 14:12 massimocode

Valid points CC @chrisdias

egamma avatar Dec 22 '15 17:12 egamma

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

ryanheath avatar Feb 10 '16 11:02 ryanheath

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

egamma avatar Feb 10 '16 11:02 egamma

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

ryanheath avatar Feb 10 '16 12:02 ryanheath

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

massimocode avatar Feb 10 '16 18:02 massimocode

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...

Spown avatar May 17 '16 13:05 Spown

@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

DonJayamanne avatar Oct 06 '16 01:10 DonJayamanne

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.

LiuJoyceC avatar Dec 22 '16 23:12 LiuJoyceC

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

AmazingJaze avatar Apr 26 '17 17:04 AmazingJaze

Yes, it's still open. 👍

joaomoreno avatar Apr 26 '17 17:04 joaomoreno

@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.

MikeGitb avatar Jun 07 '17 09:06 MikeGitb

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?

delve avatar Jun 15 '17 22:06 delve

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.

JacobJT avatar Jul 31 '17 20:07 JacobJT

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

DonJayamanne avatar Aug 05 '17 05:08 DonJayamanne

@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.

DonJayamanne avatar Aug 05 '17 05:08 DonJayamanne

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

heisian avatar Sep 13 '17 15:09 heisian