update after changes

46 views
Skip to first unread message

Claudio Delpino

unread,
Feb 1, 2018, 6:53:03 AM2/1/18
to COBRA Toolbox
Hi, I lazily did some small changes to CoBRA in my local copy of the repository (never commited them), thinking I would be able to discard them easily before updating. But even after cleaning my changes with 
git checkout . and git clean -f (because I had created a file), I'm still having problems: 

$ git status
On branch master
Your branch is behind 'origin/master' by 5176 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   binary (new commits)
        modified:   external/Volume-and-Sampling (new commits)
        modified:   test/models (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

$ git diff
diff --git a/binary b/binary
index aa550257..22d9b3e4 160000
--- a/binary
+++ b/binary
@@ -1 +1 @@
-Subproject commit aa550257879b51c5e8cd94af6c6155789fe5f14f
+Subproject commit 22d9b3e49966cbe22ac2f08e1cf1e6f5e36201d9
diff --git a/external/Volume-and-Sampling b/external/Volume-and-Sampling
index afa1caed..1c7adfb4 160000
--- a/external/Volume-and-Sampling
+++ b/external/Volume-and-Sampling
@@ -1 +1 @@
-Subproject commit afa1caed7cac9e67dec0e75931a6fe42603997d0
+Subproject commit 1c7adfb46c2c01037e625db76ff00e73616441d4
diff --git a/test/models b/test/models
index a5684e8e..92948393 160000
--- a/test/models
+++ b/test/models
@@ -1 +1 @@
-Subproject commit a5684e8ebf4fdbc854c4c0d3f51dd65766c554f7
+Subproject commit 92948393a94ba313a2f16772994aad49a874350f

Is there any pain free way to solve this and be able to pull the new commits, or is removing and re-cloning my only option ?

Best!
Claudio

Laurent Heirendt

unread,
Feb 1, 2018, 7:16:09 AM2/1/18
to COBRA Toolbox
Hi,

Your local version of the COBRA toolbox is very old. Please either clone the latest version, or do:

$ cd cobratoolbox # change to the directory (name might be different)
$ git stash
# stash all changes
$ git clean
-fdx # this removes all changes made
$ git fetch origin
# fetch the latest commits - this may take some time
$ git checkout master
# make sure to be on master
$ git reset
--hard origin/master # reset the master branch
$ git submodule
foreach --recursive git clean -fdx # clean the submodules
$ git submodule
foreach --recursive git reset --hard # reset the submodules
$ git submodule update
--init  # initialize the submodules

Please let me know if this worked.

Best,

Laurent

Claudio Delpino

unread,
Feb 1, 2018, 8:38:25 AM2/1/18
to COBRA Toolbox
Hi Laurent, 
I can't understand why the cloned version was so old.. I cloned it last week and I copied the command directly from the installation instructions page.. perhaps something wrong on my side 
(In fact, the update message began to appear  only a few days ago, perhaps something to do with my changes)

From your proposed solution, actually the last step of the process failed with: 

$ git submodule update --init
Submodule 'COBRA.papers' (https://github.com/opencobra/COBRA.papers.git) registered for path 'papers'
fatal: destination path 'C:/Users/Claudio/Documents/GitHub/cobratoolbox/papers' already exists and is not an empty directory.
fatal: clone of 'https://github.com/opencobra/COBRA.papers.git' into submodule path 'C:/Users/Claudio/Documents/GitHub/cobratoolbox/papers' failed
Failed to clone 'papers'. Retry scheduled
fatal: destination path 'C:/Users/Claudio/Documents/GitHub/cobratoolbox/papers' already exists and is not an empty directory.
fatal: clone of 'https://github.com/opencobra/COBRA.papers.git' into submodule path 'C:/Users/Claudio/Documents/GitHub/cobratoolbox/papers' failed
Failed to clone 'papers' a second time, aborting

And then from MatLab, updateCobraToolbox() failed with an error in the call to git, system replying it not being recognized as a command...  Even though git --version returns fine from my shell and git bash works fine too.. (I'm in windows 10) 

After removing and cloning again, everything seems to be fine. 

Thanks for your help anyway
Claudio

Laurent Heirendt

unread,
Feb 1, 2018, 10:31:56 AM2/1/18
to COBRA Toolbox
Hi Claudio,

Glad to hear that you got it working though.

The reason is that the version of the COBRA Toolbox is so old that the submodules are not there yet. You may try:

$ cd cobratoolbox
$ rm
-rf papers
$ git submodule update
--init

As you did, easiest is to clone and then run initCobraToolbox:

$ git clone git@github.com:opencobra/cobratoolbox.git

Best,

Laurent
Reply all
Reply to author
Forward
0 new messages