Last active
October 20, 2015 02:06
-
-
Save trevrosen/ab458f865c33a871d02e to your computer and use it in GitHub Desktop.
A shell function to set up a Go project for contribution
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 characters
# Set up a Go project for contribution. This setup gets around issues related to intra-package import paths | |
# $1 - the origin of the package, e.g. "github.com/spf13/hugo" | |
# $2 - the name of the package in the fork, e.g. "hugo" | |
# | |
export GITHUB_USERNAME="trevrosen" | |
gohack (){ | |
echo "[-] Getting package $1" | |
go get $1 | |
cd $GOPATH/src/$1 | |
echo "[-] Creating fork environment for $2" | |
git remote rename origin upstream | |
git remote add origin [email protected]:$GITHUB_USERNAME/$2 | |
git fetch --all | |
echo "[-] Setting up master" | |
git branch master --set-upstream-to origin/master | |
git checkout master | |
git checkout -b upstream-master --track upstream/master | |
echo "[-] Done!" | |
popd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment