Borrar filtros
Borrar filtros

git problem while simulink file is open

8 visualizaciones (últimos 30 días)
Ali
Ali el 28 de Sept. de 2017
Respondida: Swastik el 2 de Ag. de 2024 a las 10:58
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!

Respuestas (1)

Swastik
Swastik el 2 de Ag. de 2024 a las 10:58
Hi @Ali,
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!

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!

Translated by