- Check for Uncommitted Changes: Even though the commit button is grayed out, you can still check for uncommitted changes by running the following command in the MATLAB command window within your parent project folder:
How do I find uncommitted changes using Git within MATLAB projects?
    14 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Strider
 el 3 de Jun. de 2023
  
    
    
    
    
    Respondida: Jan Kappen
      
 el 17 de Sept. de 2024
            Background:
I am attempting to switch branches within my MATLAB project that has several submodules and those submodules are then set as references just as is done here.
While attempting to swithch branches in the parent project folder I get the attached error indicating I have uncomitted changes.  However, the commit button is grayed out with nothing showing in modified. I have attempted the following steps to debug:
- Check all submodules for uncommitted changes. - there are no uncommitted changes in submodules.
- Change branches in submodules. - I am able to change branches in each submodule that has multiple branches.
- Create a stash in the parent project folder. - No stashes are created but the status bar shows "Completed: Creating stash from modified files."
- Create a trivial modificiation to the parent project (add a folder called tst) and then commit. - I still get the same uncommitted changes while attempting to switch.
- I have pushed, pulled, and fetched and still have the same error.
This is not the first time this has happened to me. Likely this is an indicaiton of user habits.  In the past I have fixed this by removing all related files from my computer and recreating my local repo.  This is no longer sustainable.
Question:
How do I find uncommitted changes using Git within MATLAB projects?
0 comentarios
Respuesta aceptada
  Tushar
      
 el 4 de Jun. de 2023
        Hi Wesley,
It seems like you are facing issues with uncommitted changes when trying to switch branches in your MATLAB project that contains submodules. Here are a few suggestions you can try to resolve this problem:
!git status
             This will display the status of your project and any uncommitted changes. Make sure there are no modified files or    
             untracked files listed.
         2. Discard Local Changes: If you have made any local modifications within your parent project folder that are not being    
             recognized by Git, you can try discarding those changes. Use the following command to discard all local modifications:
!git checkout -- .
            This will discard all changes made to the tracked files in your project.
        3. Update Submodules: It's possible that the submodules within your project have uncommitted changes that are causing  
            the issue. Make sure to update all submodules to the latest commit on their respective branches. Use the following   
             command in each submodule directory:
!git checkout <branch-name>
!git pull
             Replace <branch-name> with the desired branch name.
         4. Reset Submodules: If updating the submodules didn't resolve the issue, you can try resetting them to the latest commit   
             on their respective branches. Use the following command in each submodule directory:
!git reset --hard HEAD
             This will reset the submodule to the latest commit, discarding any local modifications.
          5. Clean and Rebuild: If none of the above steps work, you can try cleaning and rebuilding your MATLAB project. Delete  
              any generated files or folders, such as compiled binaries, temporary files, or cached data. Then, rebuild your project   
              from scratch.
2 comentarios
  Tushar
      
 el 4 de Jun. de 2023
				Yes, most probably. Please configure git on your system. And try running the above commands. These may help resolving the issue.
Más respuestas (1)
  Jan Kappen
      
 el 17 de Sept. de 2024
        What about this command? listModifiedFiles - List modified files in project - MATLAB (mathworks.com)
0 comentarios
Ver también
Categorías
				Más información sobre Git in MATLAB en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


