git problem while simulink file is open
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm using git for source control in Simulink.
The problem is Simulink locks all open files, and whenever I want to do any operation in git which changes the files, I should close all Simulink files which are open in that git repository. do the operation and then again open all of the changed files. This takes time and is very annoying.
Is there any workaround for this, most programs and editors that I use with git allow git to change the open files and refresh after change is detected. here is a simple example, there are two git branches, master and dev, if currently dev is active and I want to checkout to master branch I get this error:
$ git checkout master
error: unable to create file file1.slx: Permission denied
Switched to branch 'master'
It actually gets worst, although git can't change the file it checks out to master branch anyway and now we have the file from dev branch in master branch!
0 comentarios
Respuestas (1)
Swastik
el 2 de Ag. de 2024 a las 10:58
When working with version control systems like Git, one should ensure that files are not locked or in use by other applications, to close all open files in MATLAB, use the following command:
fclose("all")
Refer to the below MathWorks documentation link to read more about “fclose” function:
You can also set up a “pre-checkout hook” in Git to ensure that all necessary files are closed before performing Git checkout.
You can read more about Git hooks here:
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Source Control Integration en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!