Revisions
-
EvanDotPro revised this gist
Jun 23, 2012 . 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 @@ -49,14 +49,14 @@ function gittyup() echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi if [[ $currentBranch != 'master' ]]; then git checkout master fi git fetch --all git merge upstream/master --ff-only git push origin master if [[ $currentBranch != 'master' ]]; then git checkout $currentBranch fi if [[ ! $stashed -eq 0 ]]; then git stash pop --index; fi -
EvanDotPro revised this gist
Jun 23, 2012 . 1 changed file with 1 addition 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 @@ -60,5 +60,4 @@ function gittyup() git checkout $currentBranch fi if [[ ! $stashed -eq 0 ]]; then git stash pop --index; fi } -
EvanDotPro revised this gist
Feb 9, 2012 . 1 changed file with 11 additions and 5 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 @@ -40,19 +40,25 @@ function gittyup() { local gitCheck=$(git log -n1 2>&1 1>/dev/null | wc -l) if [[ ! $gitCheck -eq 0 ]]; then echo "Error: You're not in a Git repository" return fi local currentBranch=$(git branch | grep \* | cut -d' ' -f2) local stashed=$(git stash | grep -v 'No local changes' | wc -l) if [[ ! $stashed -eq 0 ]]; then echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi if [[ ! $currentBranch -eq 'master' ]]; then git checkout master fi git fetch --all git merge upstream/master --ff-only git push origin master if [[ ! $currentBranch -eq 'master' ]]; then git checkout $currentBranch fi if [[ ! $stashed -eq 0 ]]; then git stash pop --index; fi } gittyup -
RWOverdijk revised this gist
Feb 9, 2012 . 1 changed file with 11 additions and 5 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 @@ -40,19 +40,25 @@ function gittyup() { local gitCheck=$(git log -n1 2>&1 1>/dev/null | wc -l) if [[ ! $gitCheck -eq 0 ]]; then echo "Error: You're not in a Git repository" return fi local currentBranch=$(git branch | grep \* | cut -d' ' -f2) local stashed=$(git stash | grep -v 'No local changes' | wc -l) if [[ ! $stashed -eq 0 ]]; then echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi if [[ ! $currentBranch -eq 'master' ]]; then git checkout master fi git fetch --all git merge upstream/master --ff-only git push origin master if [[ ! $currentBranch -eq 'master' ]]; then git checkout $currentBranch fi if [[ ! $stashed -eq 0 ]]; then git stash pop --index; fi } gittyup -
EvanDotPro revised this gist
Jan 3, 2012 . 1 changed file with 3 additions and 3 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 @@ -39,13 +39,13 @@ function gittyup() { local gitCheck=$(git log -n1 2>&1 1>/dev/null | wc -l) if [[ ! $gitCheck -eq 0 ]]; then echo "Error: You're not in a Git repository" return fi local currentBranch=$(git branch | grep \* | cut -d' ' -f2) local stashed=$(git stash | grep -v 'No local changes' | wc -l) if [[ ! $stashed -eq 0 ]]; then echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi @@ -54,5 +54,5 @@ function gittyup() git merge upstream/master --ff-only git push origin master git checkout $currentBranch if [[ ! $stashed -eq 0 ]]; then git stash pop --index; fi } -
EvanDotPro revised this gist
Dec 21, 2011 . 1 changed file with 41 additions and 45 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,62 +1,58 @@ #################################################################################### ## ## ## gittyup() - Easily keep master in sync with upstream. ## ## ## ## Author: Evan Coury, http://blog.evan.pro/ ## ## URL: https://gist.github.com/1506822 ## ## ## ## This bash function is a simple shortcut for keeping your local (and public ## ## fork / origin remote) master branch up to date and in sync with the upstream ## ## master. To use gittyup(), simply drop this in your ~/.bashrc. ## ## ## ## A few assumptions are made: ## ## ## ## - The remote you are updating from is named upstream. ## ## - You have a remote named origin that you can push to. ## ## - You always work in topic branches and your local master branch has not ## ## diverged from the upstream master. ## ## ## ## gittyup() performs all of the following tasks for you: ## ## ## ## 0. Verify that you are in a valid Git repo. ## ## 1. Remember which branch you are on. ## ## 2. Stash any uncommitted changes you have. ## ## 3. Checkout master. ## ## 4. Fetch all remotes. (nice to track other remotes) ## ## 5. Merge upstream/master into local master (FF ONLY!) ## ## 6. Push your updated local master branch to origin. ## ## 7. Check out the branch you were previously on. ## ## 8. Applies any stashed changes and index status. ## ## ## ## It _should_ be safe to run gittyup() in any repo where the assumptions above ## ## hold true. You can run gittyup() even when your repository is in a dirty ## ## state (uncommitted / unstaged changes) and regardless of which branch you ## ## are working in. After gittyup() is finished, it will return you to the ## ## branch you were working in and restore your working tree and index to the ## ## exact state it was in before running gittyup(). ## ## ## #################################################################################### function gittyup() { local gitCheck=$(git log -n1 2>&1 1>/dev/null | wc -l) if [[ $gitCheck != 0 ]]; then echo "Error: You're not in a Git repository" return fi local currentBranch=$(git branch | grep \* | cut -d' ' -f2) local stashed=$(git stash | grep -v 'No local changes' | wc -l) if [[ $stashed != 0 ]]; then echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi git checkout master git fetch --all git merge upstream/master --ff-only git push origin master git checkout $currentBranch if [[ $stashed != 0 ]]; then git stash pop --index; fi } -
EvanDotPro revised this gist
Dec 21, 2011 . 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 @@ -3,7 +3,7 @@ ## gittyup() - Easily keep master in sync with upstream. ## ## ## ## Author: Evan Coury, http://blog.evan.pro/ ## ## URL: https://gist.github.com/1506822 ## ## ## ## This bash function is a simple shortcut for keeping your ## ## local (and public fork / origin remote) master branch up ## -
EvanDotPro created this gist
Dec 21, 2011 .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,62 @@ ############################################################### ## ## ## gittyup() - Easily keep master in sync with upstream. ## ## ## ## Author: Evan Coury, http://blog.evan.pro/ ## ## URL: https://gist.github.com/{TBD} ## ## ## ## This bash function is a simple shortcut for keeping your ## ## local (and public fork / origin remote) master branch up ## ## to date and in sync with the upstream master. ## ## ## ## To use gittyup(), simply drop this in your ~/.bashrc. ## ## ## ## A few assumptions are made: ## ## ## ## - The remote you are updating from is named upstream. ## ## - You have a remote named origin that you can push to. ## ## - Your local master branch has not diverged from the ## ## upstream master (always work in topic branches) ## ## ## ## gittyup() performs all of the following tasks for you: ## ## ## ## 0. Verify that you are in a valid Git repo. ## ## 1. Remember which branch you are on. ## ## 2. Stash any uncommitted changes you have. ## ## 3. Checkout master. ## ## 4. Fetch all remotes. (nice to track other remotes) ## ## 5. Merge upstream/master into local master (FF ONLY!) ## ## 6. Push your updated local master branch to origin. ## ## 7. Check out the branch you were previously on. ## ## 8. Applies any stashed changes and index status. ## ## ## ## It _should_ be safe to run gittyup() in any repo where ## ## the assumptions above hold true. You can run gittyup() ## ## even when your repository is in a dirty state ## ## (uncommitted / unstaged changes) and regardless of which ## ## branch you are working in. After gittyup() is finished, ## ## it will return you to the branch you were working in and ## ## restore your working tree and index to the exact state ## ## it was in before running gittyup(). ## ## ## ############################################################### function gittyup() { local gitCheck=$(git log -n1 2>&1 1>/dev/null | wc -l) if [[ $gitCheck != 0 ]]; then echo "Error: You're not in a Git repository" return fi local currentBranch=$(git branch | grep \* | cut -d' ' -f2) local stashed=$(git stash | grep -v 'No local changes' | wc -l) if [[ $stashed != 0 ]]; then echo "Your working copy has uncommitted changes..." echo -e "These changes have been stashed and will be re-applied when we're done.\n" fi git checkout master git fetch --all git merge upstream/master --ff-only git push origin master git checkout $currentBranch if [[ $stashed != 0 ]]; then git stash pop --index; fi }