Permalink
Browse files

Added a "New Branch" command.

  • Loading branch information...
1 parent 61dd450 commit a098283c136d033ba8cb02b36bedd3847e42ca63 joshuacc committed Nov 5, 2011
Showing with 16 additions and 0 deletions.
  1. +4 −0 Default.sublime-commands
  2. +12 −0 git.py
View
@@ -40,6 +40,10 @@
"command": "git_status"
}
,{
+ "caption": "Git: New Branch",
+ "command": "git_new_branch"
+ }
+ ,{
"caption": "Git: Change Branch",
"command": "git_branch"
}
View
12 git.py
@@ -525,6 +525,18 @@ def panel_done(self, picked):
self.run_command(['git', 'checkout', picked_branch])
+class GitNewBranchCommand(GitWindowCommand):
+ def run(self):
+ self.get_window().show_input_panel("Branch name", "",
+ self.on_input, None, None)
+
+ def on_input(self, branchname):
+ if branchname.strip() == "":
+ self.panel("No branch name provided")
+ return
+ self.run_command(['git', 'branch', branchname])
+
+
class GitCheckoutCommand(GitTextCommand):
def run(self, edit):
self.run_command(['git', 'checkout', self.get_file_name()], self.checkout_done)

0 comments on commit a098283

Please sign in to comment.