Our client VPN connection is extremely slow and Git clone fails continuously. The master branch is only 300mb, but the other project branches are around 1.5Gb. I have created a branch in GitHub from one of the project branches and downloaded this code as a zip. After initializing the local unzipped folder as a git repository using "git init", it considers my code as a master branch. How do I make git link to my own remote branch instead of master. Below are the steps I did.
git init git remote add origin https://github.abc.com/ABCProject/ABC.git git pull origin mybranchname (instead of showing nothing to commit, working tree clean, it starts downloading the whole project again)
Kindly advise and provide some pointers please.
Thanks
CodePudding user response:
Not really an answer to your question but rather an alternate method, but have you tried a shallow clone of just the branch ?
git clone --branch <branch> <url> --depth 1
CodePudding user response:
git remote remove origin
git remote add -t XYZ origin https://github.abc.com/ABCProject/ABC.git
will only track the remote branch XYZ
and not automatically fetch other branches when git fetch
or git pull
is executed.