Last active
August 30, 2019 21:15
-
-
Save mtking2/3a150134794edc57dda797850823a69a to your computer and use it in GitHub Desktop.
Revisions
-
mtking2 revised this gist
Aug 30, 2019 . No changes.There are no files selected for viewing
-
mtking2 revised this gist
Apr 4, 2019 . 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 @@ -72,10 +72,10 @@ if [[ $remotes =~ upstream ]]; then if [ $working_branch == master ]; then plum_and_pom else echo -e "${blue}Checking out ${yellow}master${blue} branch${white}" git checkout master plum_and_pom echo -e "${blue}Checking back into ${yellow}$working_branch${blue} branch${white}" git checkout $working_branch plom_and_powb $working_branch fi -
mtking2 revised this gist
Aug 30, 2018 . No changes.There are no files selected for viewing
-
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 4 additions and 4 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 @@ -33,10 +33,6 @@ Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export * when on `master` branch 1. `git push origin master` (*nothing really to do here but go ahead and pull origin master because why not*) ## ```bash @@ -95,3 +91,7 @@ fi echo -e "done ${green}✓${white}" ``` ## TODO's - [ ] automagically stash uncommitted changes (if any) beforehand and then pop stash once sync is done -
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 4 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 @@ -8,7 +8,7 @@ Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export ## Breakdown of commands for various cases ### With upstream remote * when on `some-working-branch` 1. `git checkout master` @@ -23,7 +23,7 @@ Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export 1. `git pull upstream master` 2. `git push origin master` ### Without upstream remote * when on `some-working-branch` 1. `git pull origin master` @@ -37,6 +37,8 @@ Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export - [ ] automagically stash uncommitted changes (if any) beforehand and then pop stash once sync is done ## ```bash #!/bin/bash blue="\033[0;34m" -
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 31 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 @@ -6,6 +6,37 @@ If you don't have an upstream remote then it will just pull and push to origin a Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export PATH="path/to/script:$PATH"` in your favorite `~/.rc` file to run from anywhere. ## Breakdown of commands for various cases #### With upstream remote * when on `some-working-branch` 1. `git checkout master` 2. `git pull upstream master` 3. `git push origin master` 4. `git checkout some-working-branch` (*it will remember your working branch and automatically check back into it*) 5. `git pull origin master` 6. `git push origin some-working-branch` * when on `master` branch 1. `git pull upstream master` 2. `git push origin master` #### Without upstream remote * when on `some-working-branch` 1. `git pull origin master` 2. `git push origin some-working-branch` * when on `master` branch 1. `git push origin master` (*nothing really to do here but go ahead and pull origin master because why not*) ## TODO's - [ ] automagically stash uncommitted changes (if any) beforehand and then pop stash once sync is done ```bash #!/bin/bash blue="\033[0;34m" -
mtking2 revised this gist
Aug 30, 2018 . 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 @@ -1,6 +1,6 @@ # Git Upstream/Origin Sync This script will sync your origin with upstream master, whether you're currently on master or checked-out on a working branch. If you don't have an upstream remote then it will just pull and push to origin accordingly. -
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 2 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 @@ -4,6 +4,8 @@ This script will sync your origin with upstream master, whether you're on master If you don't have an upstream remote then it will just pull and push to origin accordingly. Just throw this in a file somewhere, `chmod 755` that bad boy, and then `export PATH="path/to/script:$PATH"` in your favorite `~/.rc` file to run from anywhere. ```bash #!/bin/bash blue="\033[0;34m" -
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 2 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 @@ -2,6 +2,8 @@ This script will sync your origin with upstream master, whether you're on master or checked-out on a working branch If you don't have an upstream remote then it will just pull and push to origin accordingly. ```bash #!/bin/bash blue="\033[0;34m" -
mtking2 revised this gist
Aug 30, 2018 . 1 changed file with 34 additions and 16 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,11 +1,12 @@ # Git Upstream/Origin Sync This script will sync your origin with upstream master, whether you're on master or checked-out on a working branch ```bash #!/bin/bash blue="\033[0;34m" green="\033[0;32m" yellow='\033[0;33m' white="\033[0m" # get currently checked-out branch @@ -14,28 +15,45 @@ parse_git_branch() { echo -e $branch } # pull upstream master and push origin master plum_and_pom() { echo -e "${blue}Pulling in upstream ${yellow}master$white" git pull upstream master echo -e "${blue}Pushing updates to origin ${yellow}master$white" git push origin master } # pull origin master and push origin working branch plom_and_powb() { echo -e "${blue}Pulling origin ${yellow}master$blue into $yellow$1$white" git pull origin master echo -e "${blue}Pushing updates to origin $yellow$1$white" git push origin $1 } working_branch=$(parse_git_branch) remotes="$(git remote show)" if [[ $remotes =~ upstream ]]; then # does have upstream remote if [ $working_branch == master ]; then plum_and_pom else echo -e "${blue}Checking out master branch${white}" git checkout master plum_and_pom echo -e "${blue}Checking back into $working_branch branch${white}" git checkout $working_branch plom_and_powb $working_branch fi else # does not have upstream remote if [ $working_branch == master ]; then echo -e "${blue}Pulling origin ${yellow}master$blue for kick and giggles${white}" git pull origin master else plom_and_powb $working_branch fi fi echo -e "done ${green}✓${white}" -
Michael revised this gist
Aug 24, 2018 . 1 changed file with 2 additions 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 @@ -36,6 +36,7 @@ else git pull origin master echo -e "${blue}Pushing updates to origin $working_branch${white}" git push origin $working_branch fi echo -e "done ${green}✓${white}" ``` -
Michael revised this gist
Aug 24, 2018 . 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 @@ -1,6 +1,6 @@ # Git Upstream Sync This script will sync your origin with upstream master, whether you're on master or checked-out on a working branch ```bash #!/bin/bash -
Michael created this gist
Aug 24, 2018 .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,41 @@ # Git Upstream Sync This script will sync your origin with upstream master, whether you're. ```bash #!/bin/bash blue="\033[0;34m" green="\033[0;32m" white="\033[0m" # get currently checked-out branch parse_git_branch() { local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') echo -e $branch } # pull upstream and push origin plom_and_pom() { echo -e "${blue}Pulling in upstream master$white" git pull upstream master echo -e "${blue}Pushing updates to origin$white" git push origin master } working_branch=$(parse_git_branch) if [ $working_branch == master ]; then plom_and_pom else echo -e "${blue}Checking out master branch${white}" git checkout master plom_and_pom echo -e "${blue}Checking back into $working_branch branch${white}" git checkout $working_branch echo -e "${blue}Pulling local master into $working_branch${white}" git pull origin master echo -e "${blue}Pushing updates to origin $working_branch${white}" git push origin $working_branch echo -e "done ${green}✔${white}" fi ```