I am working on a project where I use the master branch to only contain the various "release" worthy states (following the model here: https://nvie.com/posts/a-successful-git-branching-model/).
I have created a new branch for the last changes before the new release version, which includes unstaging some obsolete files (using git rm --cached file1 file2
on the local release-branch). So at the current state, my local master branch is still tracking file1 and file2, while the local release branch is not.
How can I now merge the release branch into the local master, such that the local master adopts the unstaging (i.e. is no longer tracking the two files)? When I try to change to the master branch for the merge command, I get ">error: The following untracked working tree files would be overwritten by checkout".
To be clear, I do want to keep the files in my local directory. I just want Git to stop tracking them, so that when I push my local master to my remote, the files will be removed from the remote.