Skip to content

Instantly share code, notes, and snippets.

@andersondias
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save andersondias/90a0eb445e463a1a93d9 to your computer and use it in GitHub Desktop.

Select an option

Save andersondias/90a0eb445e463a1a93d9 to your computer and use it in GitHub Desktop.

Revisions

  1. andersondias revised this gist Mar 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-release
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/usr/bin/env ruby

    # usage: git-release branch-name-1 branch-name-2 origin/remote-branch-name-3
    branchs = ARGV[0..-1]

    abort unless system("git checkout master")
  2. andersondias revised this gist Mar 11, 2015. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions git-release
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,15 @@
    #!/usr/bin/env ruby

    branchs = ARGV[0..-2]
    tag = ARGV.last
    branchs = ARGV[0..-1]

    abort unless system("git checkout master")
    abort unless system("git pull")
    abort unless system("git remote prune origin")

    system("gitk")
    print("Informe qual a tag que será usada nesse release: ")
    tag = STDIN.gets.chomp

    if branchs.size > 1
    abort unless system("git checkout -b ad-release")
    branchs.each do |branch|
  3. andersondias created this gist Mar 4, 2015.
    29 changes: 29 additions & 0 deletions git-release
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #!/usr/bin/env ruby

    branchs = ARGV[0..-2]
    tag = ARGV.last

    abort unless system("git checkout master")
    abort unless system("git pull")
    if branchs.size > 1
    abort unless system("git checkout -b ad-release")
    branchs.each do |branch|
    abort unless system("git merge --no-edit --no-ff #{branch}")
    end
    abort unless system("git checkout master")
    abort unless system("git merge --no-edit --no-ff ad-release")
    abort unless system("git branch -d ad-release")
    else
    abort unless system("git merge --no-edit --no-ff #{branchs.first}")
    end
    abort unless system("git push")
    branchs.each do |branch|
    if branch.include?('origin/')
    abort unless system("git push origin :#{branch.gsub('origin/', '')}")
    else
    abort unless system("git branch -d #{branch}")
    abort unless system("git push origin :#{branch}")
    end
    end
    abort unless system("git tag #{tag}")
    abort unless system("git push --tags")