Do I need to move my files and update my path to use git in Matlab?
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2024-2-29
"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).
采纳的回答
Mike Croucher
2024-2-29
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 个评论
Mike Croucher
2024-2-29
Yes. Which version of MATLAB are you using? In R2023b, we got a very nice command line interface to git
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!