I have a repository with a sqlite development database along side the code. Any interaction with the application tends to update the database, because that’s where sessions are stored. Frequently when switching branches, the developer must either reset or commit the sqlite file before switching.
For example:
>git checked branch2
error: Your local changes to the following files would be overwritten by checkout:
sqlite3.db
Please, commit your changes or stash them before you can switch branches.
Aborting
>git checkout sqlite3.db
>git checked branch2
Switched to branch 'branch2'
This is a small but annoying problem. I would like to be able to tell git to simply do this for me when switching branches, assuming that this single file is the only thing that has changed.
Of course, I still want to be able to check-in changes to this file when there are other files to commit as well.
Check out to your desired branch with
git checkout --force my_branch:This removes any changes in those files but lets you manually commit them should you want to do that prior to checking out into a different branch.