Started experimenting with git. Inadvertently added all the files in the project to \"Included Changes\" in Team Explorer. I committed all in an initial commit. One of t
To untrack it, simply delete it and commit that, that will remove the DB from the latest version of the repository. That is still easy from the Visual Studio UI. If you need to keep the sdf, then copy it to a temporary location.
To remove it from git (and keep it in place on the file system) you can issue the remove command from the commandline. This cannot easily be done from the Visual Studio UI.
git rm --cached yourfile.sdf
To remove the unwanted file from the repository completely, you'll need to resort to the commandline. This will remove the file from your history.
WARNING: This will rewite history, causing all your commit ids to change. WARNING
git filter-branch --prune-empty -d c:\temp\tempfolder
--index-filter "git rm --cached -f --ignore-unmatch yourfile.sdf"
--tag-name-filter cat -- --all
The file will no longer be referenced and will be removed from the repo at some point. To tell git to remove the file immediately, you need to then run:
git update-ref -d refs/original/refs/heads/master
git reflog expire --expire=now --all
git gc --prune=now --aggressive
Finally commit these changes to your remote:
git push origin --all --force
This force push requires additional permissions in TFS. By default only Project Administrators have this permission.
For more explanation, read the linked answers on the related questions.
If your remote repo has branches that you do not have locally, you may need to first pull all branches. You can do so using:
git pull --all