-
-
Save miebach/850371 to your computer and use it in GitHub Desktop.
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
#! /bin/sh | |
# Script to provide answer for question: | |
# http://stackoverflow.com/questions/5149872/how-to-git-remote-add-and-track-a-branch-in-the-same-filesystem | |
echo create origin | |
mkdir origin | |
cd origin/ | |
git init --bare | |
cd .. | |
echo clone 'a' and add some content | |
git clone origin/ a | |
cd a | |
echo hi there > hello | |
git add hello | |
git commit -m'first commit' | |
git push origin master | |
echo clone 'b' and add more content on new branch | |
cd .. | |
git clone origin/ b | |
cd b | |
git checkout -b z | |
echo new guy reporting in >> hello | |
git commit -am "new recruits" | |
echo Add 'b' as a remote to 'a' | |
cd ../a | |
git remote add b ../b | |
git fetch b | |
git branch | |
git checkout b/master | |
git checkout -t b/z | |
git branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment