Do I need to move my files and update my path to use git in Matlab?

6 visualizzazioni (ultimi 30 giorni)
I've been using Matlab for many years without source control. I have a variety of directories spread across my computer with different types of m-files grouped in a somewhat logical way. I decided recently that I would like to start using the built-in git source control to manage my software better. Based on the documentation, it seems as if I'd have to reorganize my various files and directories so that they all reside in the sandbox location. Of course, this would also require updating the path definition to this new location as well.
Is this a necessary first step in doing source control? Or can I add source control to each of my already-existing directories separately?
  2 Commenti
Stephen23
Stephen23 il 29 Feb 2024
"Based on the documentation, it seems as if I'd have to reorganize my various files and directories so that they all reside in the sandbox location"
AFAIK that is not required. But you do need to appreciate that (for better of for worse) versioning tools generally consider everything under one directory to be one project. There is nothing stopping you from having multiple projects stored in a versioning system (that is usually how people use them) saved wherever you want, but they should not overlap (i.e. be sub-folders of each other).
Doug
Doug il 29 Feb 2024
I was following Matlab help to create a local git repository. Step 7. says the sandbox folder must be empty. Based on that, it sounded like I would have to move my current working directories into the newly-created sandbox folder (then re-path my Matlab). I was hoping to avoid that.

Accedi per commentare.

Risposta accettata

Mike Croucher
Mike Croucher il 29 Feb 2024
Hi Doug
The way to think about it is that source control begins in a root directory and everything else related to that project is inside that root directory. If you are looking at a set of files scattered around your filesystem, ask yourself "What logically consistent set of projects should these be turned into?" You would then have one repository per project.
In your case, I would ask myself "Imagine my computer exploded tomorrow, How quickly could I reproduce my code environment and what are the sensible sub-projects I could do to organise this.".
Alternatively, imagine a student starts working with you. Which of your files would they need to download and install? All of them? Probably not! The 3 projects that, together, represent the thng you are collaborating on? yes!
  3 Commenti
Mike Croucher
Mike Croucher il 29 Feb 2024
Yes. Which version of MATLAB are you using? In R2023b, we got a very nice command line interface to git

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Install Products in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by