Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickly show current file on other branch #646

Closed
cideM opened this issue Feb 7, 2019 · 8 comments
Closed

Quickly show current file on other branch #646

cideM opened this issue Feb 7, 2019 · 8 comments
Assignees
Labels
feature New feature or request

Comments

@cideM
Copy link

cideM commented Feb 7, 2019

In vim-fugitive I can do :Gedit develop:%. The % expands to the current file path and the command will open that file path but from the specified branch (here develop) in my editor. How do I achieve the same in GitLens? I can compare my directory and branch and then navigate through the explorer view but that's a bit clunky. I really just want the current file on the current branch and (next to it, on the side), the same file on a different branch.

@eamodio
Copy link
Member

eamodio commented Feb 7, 2019

From the command palette, you can use the GitLens: Open Changes with Branch or Tag... — compares the active file to the tip of the selected branch. The command is also on the right-click menu of items in the Source Control sidebar.

Or you can use GitLens: Open Changes with Revision... — compares the active file with whatever revision you choose from the quick pick. The command is also on the right-click menu of items in the Explorer & Source Control sidebar. and as the alt (⌥) command of the Open Changes with Previous Revision command in the editor toolbar

image

Hope that helps!

@cideM
Copy link
Author

cideM commented Feb 8, 2019

This always opens a diff rather than the file though

@emmanueltouzery
Copy link

yes magit has the same feature in emacs. i can pick a file and say "open me that file read-only as it is currently in branch X" and you get to pick which branch. I was hoping this could available through a command in vs code or vscode-gitlens but right now I'm under the impression it's not possible as-is.

@eamodio
Copy link
Member

eamodio commented Feb 10, 2019

Ah, so to just open a readonly version of a specific revision use, Open Revision... — opens a version of the active file with whatever revision you choose from the quick pick.

@cideM
Copy link
Author

cideM commented Feb 10, 2019

That doesn't let me select a branch though ;) although it's close since I can pick the most recent commit of that branch

@eamodio
Copy link
Member

eamodio commented Feb 10, 2019

Yeah that is the equivalent. But I'll add a new command to open the revision from a branch or tag shortcut like the comparison one.

@cideM
Copy link
Author

cideM commented Feb 11, 2019

👍

(not sure if you want to leave this open actually, so I'll re-open it)

@cideM cideM closed this as completed Feb 11, 2019
@cideM cideM reopened this Feb 11, 2019
@eamodio eamodio changed the title How to show current file on other branch Quickly show current file on other branch Feb 14, 2019
@eamodio eamodio self-assigned this Feb 14, 2019
@eamodio eamodio added feature New feature or request and removed question labels Feb 14, 2019
@eamodio eamodio added this to the Soon™ milestone Feb 14, 2019
@eamodio eamodio removed this from the Soon™ milestone Jul 19, 2019
@github-actions
Copy link

github-actions bot commented Dec 1, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@emmanueltouzery @eamodio @cideM and others