-
-
Save dixudx/e56435e89361e4bc50db802687fb03e0 to your computer and use it in GitHub Desktop.
Revisions
-
fernandoaleman revised this gist
Sep 8, 2016 . 1 changed file with 1 addition and 1 deletion.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 @@ -6,4 +6,4 @@ Example: git-sync-fork upstream origin -
fernandoaleman revised this gist
Sep 8, 2016 . 1 changed file with 2 additions and 2 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 @@ -7,8 +7,8 @@ usage() { echo "Usage:" echo "$0 <upstream-remote> <target-remote>" echo "" echo "Example which ensures remote named 'origin' have all the same branches and tags as 'upstream'" echo "$0 upstream origin" exit 1 } -
fernandoaleman revised this gist
Sep 8, 2016 . 1 changed file with 15 additions and 13 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 @@ -4,37 +4,39 @@ UPSTREAM=$1 MYREPO=$2 usage() { echo "Usage:" echo "$0 <upstream-remote> <target-remote>" echo "" echo "Example which ensures remote named 'fernandoaleman' have all the same branches and tags as 'origin'" echo "$0 origin fernandoaleman" exit 1 } if [ -z "$UPSTREAM" ] then echo "Missing upstream remote name." usage fi if [ -z "$MYREPO" ] then echo "Missing target remote name." usage fi read -p "1. This will setup '$MYREPO' to track all branches in '$UPSTREAM' - Are you sure ?" -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then echo "\n" for brname in `git branch -r | grep "$UPSTREAM" | grep -v master | grep -v HEAD | sed -e 's/.*\///g'`; do git branch --track $brname $UPSTREAM/$brname ; done fi read -p "2. This will push all local branches and tags into '$MYREPO' - Are you sure ?" -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then echo "\n" git push --all $MYREPO git push --tags $MYREPO fi -
fernandoaleman revised this gist
Sep 8, 2016 . 1 changed file with 9 additions and 0 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,9 @@ 1. Copy 'git-sync-fork' script code from gist 2. Create a file called 'git-sync-fork' in any 'bin' directory in your $PATH 3. Paste script into this new file 'git-sync-fork' and save 4. Make the file executable `chmod +x git-sync-fork` 5. Run the script inside your locally forked git repo Example: git-sync-fork origin fernandoaleman -
fernandoaleman created this gist
Sep 8, 2016 .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,40 @@ #!/bin/sh UPSTREAM=$1 MYREPO=$2 usage() { echo "Usage:" echo "$0 <upstream-remote> <target-remote>" echo "" echo "Example which ensures remote named 'fernandoaleman' have all the same branches and tags as 'origin'" echo "$0 origin fernandoaleman" exit 1 } if [ -z "$UPSTREAM" ] then echo Missing upstream remote name. usage fi if [ -z "$MYREPO" ] then echo Missing target remote name. usage fi read -p "1. This will setup '$MYREPO' to track all branches in '$UPSTREAM' - Are you sure ?" -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then for brname in `git branch -r | grep "$UPSTREAM" | grep -v master | grep -v HEAD | sed -e 's/.*\///g'`; do git branch --track $brname $UPSTREAM/$brname ; done fi read -p "2. This will push all local branches and tags into '$MYREPO' - Are you sure ?" -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then git push --all $MYREPO git push --tags $MYREPO fi