'How do I open all files of a commit VS CODE
How do I open all files edited in a commit in the editor window? I know I can see files of a commit in Source Control -> Commits section. But is there a shortcut?
Edit: I found that I can open them buy clicking on commit message and right click then Open Changes -> Open Files.
Is there a way I can make shortcut for it?
Solution 1:[1]
In the commit pane in the version control panel:
- Right click on the Commit
- Open Changes
- Open Files
The command from the command pallet is git: open changes
you can assign commands to key bindings.
With the gitlens extension installed GitLens: Open Changed Files
is probably what you're after?
Solution 2:[2]
Here's how you can do this through the command line:
code $(git diff-tree --no-commit-id --name-only -r HEAD)
This will open all of the files in the most recent commit that you have checked out. The git command gets the diff of HEAD, suppresses commit id, only logs the name of the files, and opens them all using the code
command, assuming you have that installed
Solution 3:[3]
Execute this command from a shell
code $(git diff --no-commit-id --name-only -r HEAD)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | THEMike |
Solution 2 | Luca Provencal |
Solution 3 | Black |