Created
March 1, 2011 18:43
-
-
Save idbrii/849624 to your computer and use it in GitHub Desktop.
example for How to 'git remote add' and track a branch in the same filesystem
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 ci -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 ci -am "new recruits" | |
echo Add 'b' as a remote to 'a' | |
cd ../a | |
git remote add b ../b | |
git fetch b | |
git br | |
git checkout b/master | |
git checkout -t b/z | |
git br |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment