Last active
February 5, 2019 23:48
-
-
Save realityforge/554fbe5cc516e7da52abe0850c33861f to your computer and use it in GitHub Desktop.
Revisions
-
realityforge renamed this gist
Feb 5, 2019 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,18 @@ PROJECT_NAME='jsinterop-generator' PROJECT_SLUG='jsinterop-generator' UPSTREAM_OWNER='google' LOCAL_OWNER='realityforge' LOCAL_BRANCHES_TO_KEEP=%w(TravisCiIntegration) #WARNING this will delete local branches which may contain your changes DELETE_LOCAL_BRANCHES=true def mysystem(command, fail_on_error = true) puts "system (#{Dir.pwd}): #{command}" if @verbose system(command) || !fail_on_error || (raise "Error executing #{command} in #{Dir.pwd}") end mysystem("git clone https://github.com/#{LOCAL_OWNER}/#{PROJECT_SLUG}.git") unless File.exist?(PROJECT_SLUG) Dir.chdir PROJECT_SLUG -
realityforge revised this gist
Aug 28, 2017 . 1 changed file with 20 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,42 @@ PROJECT_NAME='graphql-java' PROJECT_SLUG='graphql-java' UPSTREAM_OWNER='graphql-java' LOCAL_OWNER='realityforge' LOCAL_BRANCHES_TO_KEEP=%w() #WARNING this will delete local branches which may contain your changes DELETE_LOCAL_BRANCHES=true def mysystem(command, fail_on_error = true) puts "system (#{Dir.pwd}): #{command}" if @verbose system(command) || !fail_on_error || (raise "Error executing #{command} in #{Dir.pwd}") end mysystem("git clone https://github.com/#{LOCAL_OWNER}/#{PROJECT_SLUG}.git`") unless File.exist?(PROJECT_SLUG) Dir.chdir PROJECT_SLUG mysystem("git remote add upstream https://github.com/#{UPSTREAM_OWNER}/#{PROJECT_SLUG}.git", false) mysystem("git fetch upstream") mysystem("git checkout upstream/master") mysystem("git branch -f upstream") mysystem("git checkout upstream") mysystem("git push --set-upstream -f origin upstream") if DELETE_LOCAL_BRANCHES `git ls-remote --heads --refs 2>/dev/null`.split("\n").each do |line| if line =~ /^.*refs\/heads\/(.*)$/ head = $1 next if (LOCAL_BRANCHES_TO_KEEP + %w(master upstream)).include?(head) puts "Removing branch #{head}" mysystem("git push origin :#{head}") mysystem("git branch -d #{head}", false) end end end `git ls-remote --tags --refs 2>/dev/null`.split("\n").each do |line| if line =~ /^.*refs\/tags\/(.*)$/ @@ -39,7 +47,7 @@ def mysystem(command, fail_on_error = true) end end mysystem("git branch -d master", false) mysystem("git checkout --orphan master") mysystem("git rm --cached -r .") mysystem("git add .") @@ -48,11 +56,11 @@ def mysystem(command, fail_on_error = true) IO.write("README.md",<<CONTENT) # Peter Donald's #{PROJECT_NAME} Repository This repository contains feature branches for the upstream repository: [#{PROJECT_NAME}](https://github.com/#{UPSTREAM_OWNER}/#{PROJECT_SLUG}). It doesn not contain a meaningful master branch. CONTENT mysystem("git add -f README.md") mysystem('git commit -m "Add a README that describes the purpose of the repository."') mysystem("git push --set-upstream -f origin master") mysystem("git checkout upstream") -
realityforge revised this gist
Aug 28, 2017 . 2 changed files with 58 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ PROJECT_NAME='Schmooze' PROJECT_SLUG='schmooze' UPSTREAM_OWNER='Shopify' LOCAL_OWNER='realityforge' def mysystem(command, fail_on_error = true) puts "system (#{Dir.pwd}): #{command}" if @verbose system(command) || !fail_on_error || (raise "Error executing #{command} in #{Dir.pwd}") end mysystem("git clone https://github.com/#{LOCAL_OWNER}/#{PROJECT_SLUG}.git`") Dir.chdir PROJECT_SLUG mysystem("git remote add upstream https://github.com/#{UPSTREAM_OWNER}/#{PROJECT_SLUG}.git") mysystem("git fetch upstream") mysystem("git checkout upstream/master") mysystem("git branch upstream") mysystem("git checkout upstream") mysystem("git push origin upstream") `git ls-remote --heads --refs 2>/dev/null`.split("\n").each do |line| if line =~ /^.*refs\/heads\/(.*)$/ head = $1 next if %w(master upstream).include?(head) puts "Removing branch #{head}" mysystem("git push origin :#{head}") mysystem("git branch -d #{head}") end end `git ls-remote --tags --refs 2>/dev/null`.split("\n").each do |line| if line =~ /^.*refs\/tags\/(.*)$/ tag = $1 puts "Removing tag #{tag}" mysystem("git push origin :#{tag}") mysystem("git tag -d #{tag}") end end mysystem("git branch -d master") mysystem("git checkout --orphan master") mysystem("git rm --cached -r .") mysystem("git add .") mysystem("git reset --hard") IO.write("README.md",<<CONTENT) # Peter Donald's #{PROJECT_NAME} Repository This repository contains feature branches for the upstream repository: [#{PROJECT_NAME}](https://github.com/#{UPSTREAM_OWNER}/#{PROJECT_SLUG}.git). It doesn not contain a meaningful master branch. CONTENT mysystem("git add -f README.md") mysystem('git commit -m "Add a README that describes the purpose of the repository."') mysystem("git push --set-upstream -f origin master") This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +0,0 @@ -
realityforge renamed this gist
Aug 28, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
realityforge created this gist
Aug 28, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ git clone https://github.com/realityforge/RxJS.git cd RxJS git remote add upstream https://github.com/Reactive-Extensions/RxJS.git git fetch upstream git checkout upstream/master git branch upstream git checkout upstream git push origin upstream git branch -d master git checkout --orphan master git rm --cached -r . echo "# Peter Donald's RxJS Repository This repository simply is used to submit commits back to the upstream [RxJS](https://github.com/Reactive-Extensions/RxJS.git) repository and thus only contains feature branches and no meaningful master branch. " > README.md git add -f README.md git commit -m "Add a README that describes the purpose of the repository." git push --set-upstream -f origin master