summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Lucarella <leandro.lucarella@sociomantic.com>2015-04-09 17:35:19 +0200
committerMihails Strasuns <mihails.strasuns.contractor@sociomantic.com>2015-04-10 14:10:16 +0300
commitcdad1b2d627d4a1cf679d0be4232353d3dd6e0c9 (patch)
treeeac4fe9c3b2df6b5e71d332663202ce4356976d1
parenteda9b2631f36f7474ba1610284370a67d2ba914e (diff)
Add a pull rebase --delete-branch option
This emulates the "Delete Branch" button in GitHub's web interface. Fixes #129.
-rwxr-xr-xgit-hub9
-rw-r--r--man.rst5
2 files changed, 14 insertions, 0 deletions
diff --git a/git-hub b/git-hub
index fe03aaf..366036b 100755
--- a/git-hub
+++ b/git-hub
@@ -1492,6 +1492,10 @@ class RebaseCmd (PullUtil):
action='store_true', default=False,
help="uses git stash save --all when stashing local "
"changes")
+ parser.add_argument('-D', '--delete-branch',
+ action='store_true', default=False,
+ help="removes the PR branch, like the Delete "
+ "Branch button (TM)")
@classmethod
def run(cls, parser, args):
@@ -1757,6 +1761,11 @@ class RebaseCmd (PullUtil):
base_ref, base_url)
git_push(base_url, 'HEAD:' + base_ref,
force=args.force_push)
+ if args.delete_branch:
+ infof('Removing pull request branch {} in {}',
+ head_ref, head_url)
+ git_push(head_url, ':' + head_ref,
+ force=args.force_push)
return git('rev-parse HEAD')
finally:
if not cls.in_conflict and not cls.in_pause:
diff --git a/man.rst b/man.rst
index 4beee69..2732f6b 100644
--- a/man.rst
+++ b/man.rst
@@ -363,6 +363,11 @@ COMMANDS
cleaned in addition to the untracked files, which completely removes the
possibility of conflicts when checking out the pull request to reabase.
+ \-D, --delete-branch
+ Delete the pull request branch if the rebase was successful. This is
+ similar to press the "Delete Branch" Button (TM) in the web interface
+ after merging.
+
Actions:
\--continue