Frage

I am trying to set up a local repository (LOCAL_REPO) from some git branch (MASTER) which is to be used by a group of people.

MASTER------>LOCAL_REPO

To do this i did the following :

  1. git clone /path to master
  2. git checkout -b LOCAL_REPO MASTER

This creates a branch LOCAL_REPO for me at my local shared directory (SHARED_PATH)

Now this LOCAL_REPO is used amon a set of people and any changes that they commit will be to LOCAL_REPO which can be synced with MASTER. So i tried creating local branch(MY_LOCAL) for myself at some path.

  1. git clone SHARED_PATH
  2. got checkout -b MY_LOCAL LOCAL_REPO

I am facing following issues :

  1. when i create MY_LOCAL MASTER is checked out by default. Should it not be LOCAL_REPO
  2. while trying the second option i get the following error :

Blockquote fatal: git checkout: updating paths is incompatible with switching branches

After that i tried "git remote show origin" , this shows me LOCAL_REPO as remote and tracked. What is the mistake i am doing here ?

War es hilfreich?

Lösung

When you're doing a git clone it will checkout a master branch by default. To specify branch during clone use (in your case)

git clone SHARED_PATH -b LOCAL_REPO

And for your 2nd issue, probably git pull --all should help

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top