Search code examples
gitazure-devopsbranchazure-machine-learning-service

Azure ML, DevOps: Switching between branches keeps some files from another branch


I use Azure Machine Learning Workspace Notebooks, connected to a DevOps Repository - using terminal git commands to manage my code. I work on different branches, often has to switch back and forth between them.

I reviewed this thread before: switching branches keeps new files from other branch

In my case it does not only keep the files that should be ignored with the use of the gitignore file, but others too.

I tested it with a totally empty branch, that should not have any files in it, checked it out, and it still has files from the branch that I worked with previously. When I check it manually on DevOps, in the repo, the empty branch is actually empty there.

Has anyone seen similar issues?


Solution

  • Some files that are tracked in a branch could be not tracked in another. So when you switch back to the "non tracking" branch, that files remain in the file system. Git does not clean stuff that does not track directly. Do not exchange the term not tracked by ignored. Files are not tracked until we "add" them in stage and commit. You could cleanup the working git by running git clean -f -d