Skip to content

Instantly share code, notes, and snippets.

@darrinholst
Last active July 15, 2016 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrinholst/d2db050539141b82be408696490b3de7 to your computer and use it in GitHub Desktop.
Save darrinholst/d2db050539141b82be408696490b3de7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo -e "\n\n***\n*** Cleaning up\n***\n\n"
rm -rf ws1 ws2 remote
mkdir ws1 ws2 remote
echo -e "\n\n***\n*** initialize the remote repo\n***\n\n"
cd remote
git init --bare
cd ..
echo -e "\n\n***\n*** initialize workspace 1\n***\n\n"
cd ws1
git init
gtm init
echo "#GTM test" > README.md
git add .
git commit -m "initial commit"
git remote add origin $(cd ../remote && pwd)
git push origin master -u
cd ..
echo -e "\n\n***\n*** initialize workspace 2\n***\n\n"
cd ws2
git clone ../remote .
gtm init
cd ..
echo -e "\n\n***\n*** do some work in workspace 1, but don't push gtm\n***\n\n"
cd ws1
vim README.md
git commit -am "from workspace 1"
git push
cd ..
echo -e "\n\n***\n*** do some work in workspace 2 and push gtm\n***\n\n"
cd ws2
git pull
vim README.md
git commit -am "from workspace 2"
git push
git pushgtm
cd ..
echo -e "\n\n***\n*** back to workspace 1 to try and fetch gtm\n***\n\n"
cd ws1
git pull
git fetchgtm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment