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

Add a menu to checkout any version of the file #558

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
,{ "caption": "-" }
,{ "caption": "Reset", "command": "git_raw", "args": { "command": "git reset HEAD", "append_current_file": true, "show_in": "suppress" } }
,{ "caption": "Checkout (Discard Changes)", "command": "git_raw", "args": { "command": "git checkout", "append_current_file": true } }
,{ "caption": "Checkout (Any version)", "command": "git_log_checkout" }
,{ "caption": "-" }
,{ "caption": "Quick Commit Current File", "command": "git_quick_commit" }
,{ "caption": "Commit Selected Hunk", "command": "git_commit_selected_hunk" }
Expand Down
10 changes: 10 additions & 0 deletions git/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ class GitLogAllCommand(GitLog, GitWindowCommand):
pass


class GitLogCheckoutCommand(GitLogCommand):
"""This command is used to check any version of a file."""
def log_result(self, ref):
self.run_command(
['git', 'checkout', ref, '--', self.get_file_name()])

def details_done(self, result):
pass


class GitShow(object):
def run(self, edit=None):
# GitLog Copy-Past
Expand Down