I broke the Binary module in git

75 views
Skip to first unread message

Uri David Akavia

unread,
Jul 14, 2017, 8:20:02 AM7/14/17
to COBRA Toolbox
Hi.

In one of my git updates of the cobra toolbox (https://github.com/akaviaLab/cobratoolbox), I managed to break the binary submodule. 
At this stage, running the command "git submodules update --init" doesn't return it.
I tried adding the module, using "git submodule add --name binary https://github.com/opencobra/COBRA.binary.git" but that created a diretory called COBRA.binary in my cobratoolbox directory.

Are there any options besides redownloading the source code, and rechecking out opencobra HEAD? If I should do that, what's the best way of doing that?

Thank you.

Uri David

Uri David Akavia

unread,
Jul 14, 2017, 8:21:13 AM7/14/17
to COBRA Toolbox
COBRAconfigReport.log

Laurent Heirendt

unread,
Jul 18, 2017, 2:28:41 PM7/18/17
to COBRA Toolbox
Hi,

May you try:

$ cd fork-cobratoolbox/binary
$ git reset
--hard origin/master
$ git submodule update


That should fix it. Please let me know if this worked.

Best,

Laurent

Uri David Akavia

unread,
Jul 18, 2017, 2:47:34 PM7/18/17
to cobra-...@googlegroups.com
Hi.

That hasn't worked, since the breakage was several commits ago, and my origin is my fork on github, which doesn't have binary module any more. Should I try
git reset --hard remote/master?

Thanks.

Uri David 

--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/gHJfg663F0I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbox+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Laurent Heirendt

unread,
Jul 18, 2017, 3:00:07 PM7/18/17
to COBRA Toolbox
Hi,

Sorry to hear that. May you try:

$ cd fork-cobratoolbox
$ git checkout master
# make sure you checked out the master branch
$ git reset
--hard origin/master # this reset the master branch to the head of the master branch in origin (your fork in this case)
$ git remote add upstream git@github
.com:opencobra/cobratoolbox.git # this adds the remote of the opencobra repo (this should already be there)
$ git fetch upstream
# this fetches all the new updates from the opencobra repository
$ git merge upstream
/master # this updates the master branch locally
$ git reset
--hard upstream/master # this reset the master branch if the merge failed (optional)
$ git submodule update
--init # this updates the submodules
$ git checkout develop
# don't forget to now checkout the develop branch
$ git merge upstream
/develop # this updates the develop branch locally
$ git reset
--hard upstream/develop # this reset the develop branch if the merge failed (optional)
$ git submodule update
--init # this updates the submodules

Please let me know if this worked.

Best,

Laurent

Uri David Akavia

unread,
Jul 18, 2017, 3:45:11 PM7/18/17
to cobra-...@googlegroups.com
Hi.

I followed the instructions, and it almost worked (binary was corrected). Now, if I try to merge, I get an error message

fatal: No current branch.

If I try to commit

$ git commit

HEAD detached from upstream/develop

Changes not staged for commit:

modified:   binary (modified content)

no changes added to commit

============

$ git status

HEAD detached from upstream/develop

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)

  (commit or discard the untracked or modified content in submodules)


modified:   binary (modified content)


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

============

If I try to repeat your instructions, I get an error message with checkout

$ git checkout master

error: The following untracked working tree files would be overwritten by checkout:

binary/glnxa64/lib/libminos.a

binary/maci64/lib/libminos.a

Please move or remove them before you switch branches.

Aborting

================

Any suggestions on what to do now?

Thank you very much.

Yours,

Uri David


Laurent Heirendt

unread,
Jul 19, 2017, 1:39:37 AM7/19/17
to COBRA Toolbox
Hi,

Great to hear that the binary submodule was corrected. Your git repository is currently in a detached head. May you try:

$ cd fork-cobratoolbox/binary # make sure you go into the binary submodule
$ git stash
# stash any changes

$ git reset
--hard origin/master

If that doesn't work, you may also try:

$ cd fork-cobratoolbox # make sure you are in the root of the fork
$ git checkout
-- binary/glnxa64/lib/libminos.a
$ git checkout
-- binary/maci64/lib/libminos.a

If that doesn't work, then try:

$ cd fork-cobratoolbox # make sure you are in the root of the fork
$ git clean
-fd
$ git reset
--hard origin/master

I am not sure what really went wrong here, but in such cases, it might just be faster to re-clone the fork.

Best,

Laurent

Uri David Akavia

unread,
Jul 19, 2017, 6:09:13 AM7/19/17
to cobra-...@googlegroups.com
Hi Laurent,

Thank you very much for all your help.
This still hasn't worked.

So, just to check before I do this - should I delete my existing repository before cloning? Should I delete the .git directory or not?

I'm thinking something like
cd fork-cobratoolbox
rm -r ./*
git push
initCobraToolbox
testAll

Have I got the commands right?

Thank you.

Uri David

Laurent Heirendt

unread,
Jul 19, 2017, 8:41:39 AM7/19/17
to COBRA Toolbox
Hi,

I am sorry to hear the issues with your local repository are still not fixed. Your commands are not correct.

I recommend removing the current fork-cobratoolbox folder entirely, i.e. :

$ rm -rf fork-cobratoolbox

May you use the MATLAB.devTools in order to start over with a new fork-cobratoolbox folder?

Best regards,

Laurent

Uri David Akavia

unread,
Jul 20, 2017, 9:00:31 AM7/20/17
to cobra-...@googlegroups.com
Hi,

I'm not sure about using MATLAB.devTools, since most of what I change in the code is minor fixes, when I use the code and find bugs. It wouldn't necessarily be a feature (branch), since I don't really plan what I'll fix until I hit a bug. 

I'm not sure what the advantage of using MATLAB.devTools as compared to github Desktop. Should I try to have one branch of bug fixes and minor improvements (call it "akavia-fixes" for example), and just keep updating it? If I use MATALB.devTools do I need to make a new branch every time I make a PR?

Thank you,

Uri David

Laurent Heirendt

unread,
Jul 20, 2017, 1:49:10 PM7/20/17
to COBRA Toolbox
Hi,

The MATLAB.devTools have been designed and developed for exactly your use case: minor fixes to be submitted quickly. The idea is to make a change to the code on an own branch, and to then merge it to the develop branch in a pull request.

Please make a new branch for each new fix. The simple reason is this: if you work on your own branch, let's say <akavia-fixes>, and there is 1 commit that will be cherry-picked, modified, or not included in the develop branch, you will get a conflict over and over. Also, that branch is not necessarily updated properly.

It is that easy: one branch per fix = 1 pull request. Note that one branch can contain multiple commits. Do as many commits as you want, ideally, 1 commit should only contain 1 to 5 files. You will end up with multiple branches, but once the pull request has been accepted, you can safely delete them.

The advantage of the MATLAB.devTools over Github Desktop is that everything is automatic: your fork is updated, your branch checked out, and even the pull request link is provided when publishing. Generally, with the devTools, your changes are on Github within 20-30 seconds (depending on your internet connection speed, and not counting the time that you need to make the actual change). And most importantly: you don't need to worry anymore about updating your fork, or changing the branch. Simply type >> contribute and select the menu option.

I strongly recommend to try them out - they have been developed particularly for contributors of the COBRA Toolbox!

Best,

Laurent

Laurent Heirendt

unread,
Jul 20, 2017, 1:52:07 PM7/20/17
to COBRA Toolbox
Hi,

I forgot to mention that you can contribute from within MATLAB - right there, where you edited the code. No need to switch applications(!).

Best,

Laurent

Uri David Akavia

unread,
Jul 23, 2017, 4:53:50 PM7/23/17
to cobra-...@googlegroups.com
Hi Laurent,

I'm trying to use MATLAB.devTools, and I find it a bit odd.
First, it insists on using a subdirectory called fork-cobratoolbox. I guess I can change that if I modify assets/confDevTools. I also set up the wrong root directory (~/Documents/cobratoolbox), and would like to change it, but I'm not sure how. It asked me what directory I would like first time, but I can't get it to ask again.

Second, I've tried cloning the directory, as detailed in cobratoolbox README (https://github.com/opencobra/cobratoolbox/blob/master/README.md) by running
and then trying to run contribute.m, but that's not working well.

Is there any way I can set up MATLABdevTools to make use ~/Documents/MATLAB/cobratoolbox (which is already a clone of the opencobra repository)?

Thank you,

Uri David

Uri David Akavia

unread,
Jul 23, 2017, 5:30:45 PM7/23/17
to cobra-...@googlegroups.com
Hi Laurent,

Right now, fork-cobratoolbox seems to work. If there is a way of changing the name after I've started working, good.
If not, or if I should just keep it as fork-cobratoolbox to differentiate from released versions or something, I can keep it this way.

Uri David

Laurent Heirendt

unread,
Jul 25, 2017, 11:42:42 AM7/25/17
to COBRA Toolbox
Hi,

Good to hear that it works. 

Please keep cobratoolbox for the official repository and fork-cobratoolbox for the forked repository. All code is set up to work with these folder names.

Thanks,

Laurent

Ronan M.T. Fleming

unread,
Jul 25, 2017, 12:27:05 PM7/25/17
to COBRA Toolbox
Hi All,
I highly recommend using MATLAB.devTools. I use it myself all the time, even though I used to use git commands from the terminal. We can realistically only provide support for MATLAB.devTools but not git itself, which is a powerful but complex tool to use.
Regards,
Ronan

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
--
--
Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.
----------------------------------------------------------------------------
Senior research associate (EN) == Chercheur (FR),
Principal investigator,
Systems Biochemistry Group,
wwwen.uni.lu/lcsb/research/systems_biochemistry
Luxembourg Centre for Systems Biomedicine,
University of Luxembourg,
Campus Belval,
6, avenue du Swing,
L-4367 Belvaux.
&
National Centre of Excellence in Research on Parkinson’s disease
www.parkinson.lu
&
Adjunct Assistant Professor,
Division of Analytical Biosciences,
Leiden Academic Centre for Drug Research,
Faculty of Science,
University of Leiden.
http://analyticalbiosciences.leidenuniv.nl
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Mobile:  +352 621 175 112
Office: +352 466 644 5528
Skype: ronan.fleming
----------------------------------------------------------------------------
(This message is confidential and may contain privileged information. It is intended for the named recipient only. If you receive it in error please notify me and permanently delete the original message and any copies.)
Reply all
Reply to author
Forward
0 new messages