I accidentally committed my development.sqlite3 file to Git, and it seems to be slowing down my commits. I know about .gitignore, but does this take the file out of my repository once I've done so? My concern is is with reducing the commit and push times.
No. All the .gitignore file does is tell the various Git user interface tools to ignore that file when batch-committing changes. You can still manually put any individual file you want into Git's database, and adding entires there will not remove anything from the Git revision database.
There's no need for fanciness with filter-branch - this is just in one recent commit. If not, simply remove the file (git rm --cached <filename>
) and amend your commit (git commit --amend
). The --cached
option tells git to only remove the copy in the index (the commit staging area), and leave the version in the work tree intact.
If it's farther back in the history, you can use interactive rebase (git rebase -i <commit before the bad one> master
), choose to edit
the bad commit, and rm/amend as before. Be sure to add it to your gitignore as well, of course.
Note that if you've already pushed this commit, you'll have to use push -f
to get the non-fast-forward to push, and if anyone else has pulled it already, they'll be annoyed (see the "recovering from upstream rebase" section in the man page of git-rebase.