-
Notifications
You must be signed in to change notification settings - Fork 1
Clone With Submodules
The common repository (containing the interfaces) was added to the fuc repository as a submodule. You will find it at /code/common
. This is a short guide on how to use the submodule in github.
When you clone the fuc repository the submodule located in /code/common
will not be cloned automatically. Instead you will find an empty folder at this location.
If you clone the fuc repository you can use this command to clone the submodule automatically
git clone [email protected]:swp-uebersetzerbau-ss13/fuc.git --recursive
If you have already cloned the fuc repository without the submodule, you can get the contents of the submodule by calling
git submodule init
git submodule update
A Submodule always points to one exact commit of the cloned project (common in our cases). If changes are made in the common branch they will not automatically appear within the common submodule in the fuc repository. To update the submodule in the fuc repository you need to run these commands
cd code/common
git checkout master
git pull
cd ../..
git add code/common
git commit -m "pulled update for submodule"
git push
The Submodule in /code/common is read only. You can not push changes made in this directory. If you want to change code inside /code/common submodule you have to update the common repository. After pushing your changes to the common repository follow the Procedure described above "Updating The Submodule".
If you run git submodule update
and get this error
fatal: reference isn’t a tree: ...
Unable to checkout ...
Somebody changed code inside the submodule code/common and commited the changes to the fuc repository. Now the submodule points to a commit not existing in the common branch. Therefore nobody can checkout the submodule.
Solution:
Execute the following command git log -1 code/common
to see who corrupted the submodule and start yelling at him. :D