Skip to content
This repository has been archived by the owner on May 21, 2023. It is now read-only.

Commit

Permalink
Update git-publish script.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshukraine committed Mar 8, 2020
1 parent c047a65 commit becaa0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/git-publish
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# https://github.com/christoomey/dotfiles/blob/77fb4084bd3f207aace80aa93a49769a6a298ddb/bin/git-publish
# Usage: git publish <remote-branch-name>
# Open the pull request page for <branch>, or the current branch if not
# specified. Lands on the new pull request page when no PR exists yet.
# The local branch must be tracking the remote branch.

def get_current_branch
def read_current_branch
`git rev-parse --abbrev-ref HEAD`.chomp
end

def main
current_branch = get_current_branch
current_branch = read_current_branch
if current_branch == "master"
$stderr.puts "Currently on master, aborting."
warn "Currently on master, aborting."
exit 1
else
system("git push -u origin #{current_branch}:#{current_branch}")
Expand Down

0 comments on commit becaa0e

Please sign in to comment.