Randomly committed dev database for git

I accidentally passed the development.sqlite3 file to Git, and it seems to slow down my commits. I know about .gitignore, but does it make a file from my repository as soon as I do this? My concern is to reduce the time of fixing and pressing.

+4
source share
3 answers

No bizarre need with a filter-branch - it's just in one recent commit. If not, just delete the file ( git rm --cached <filename> ) and fix the commit ( git commit --amend ). The --cached option tells git to remove only the copy in the index (commit execution area) and leave the version in the work tree intact.

If this is even deeper in history, you can use interactive rebase ( git rebase -i <commit before the bad one> master ), select edit bad commit and rm / modify as before. Be sure to add it to your gitor too, of course.

Please note that if you have already clicked on this commit, you will need to use push -f to get an immediate fast forward, and if someone else pulled it, they will be annoyed (see the “Recovery from upstream” section on page git-rebase guides.

+6
source

Try the following:

  git filter-branch --tree-filter ´rm filename´ HEAD 
+1
source

Not. The entire .gitignore file tells various Git user interface tools to ignore this file when making changes to the package. You can still manually place any single file in the Git database, and adding to it will not remove versions of Git from the database.

-1
source

Source: https://habr.com/ru/post/1306413/


All Articles