I ran the command git update-index --assume-unchanged .\src\main\resources\application.properties
in my local directory, and the application.properties
file disappeared from the Changes
section of Source Control
in VS Code, as I expected.
However, the diff still shows red deletions & green additions, as if the file is still being tracked. <-- this is shown in the screenshot below
I'm also prevent from switching branches, for the reason that "changes would overwrite that file"
Any ideas why this is happening? I want a base version in my remote repository that I can change locally without the changes being tracked.
I saw the --skip-worktree
option and tried git update-index --skip-worktree .\src\main\resources\application.properties
, but got the same results.
Here's the git commands & output
PS C:\r\Body-Tracking-Uploader> git update-index --assume-unchanged .\src\main\resources\application.properties
PS C:\r\Body-Tracking-Uploader> git status
On branch upload-exerciseInfo-aws
Your branch is up to date with 'origin/upload-exerciseInfo-aws'.
nothing to commit, working tree clean
PS C:\r\Body-Tracking-Uploader> git branch
main
* upload-exerciseInfo-aws
PS C:\r\Body-Tracking-Uploader> git checkout main
error: Your local changes to the following files would be overwritten by checkout:
src/main/resources/application.properties
Please commit your changes or stash them before you switch branches.
Aborting
PS C:\r\Body-Tracking-Uploader>
I'm not totally sure what the problem was, but I took the following steps
main
(it's not feature-complete yet, but functions in its current state)main
in the remote repository (to continue the previous WIP feature)main
into my localgit update-index --skip-worktree .\src\main\resources\application.properties
Now the changes do not show in the Source Control view, and they don't prevent me from moving between branches locally.