Git ignore deleted files

后端 未结 4 1669
灰色年华
灰色年华 2020-12-28 07:57

I have a website project that has more than 50,000 unimportant files (to development) in some directories.

/website.com/files/1.txt
/website.com/files/2.txt
         


        
4条回答
  •  清歌不尽
    2020-12-28 08:51

    The code below works on deleted as well as modified files to ignore it when you do a git status.

     git update-index --assume-unchanged dir-im-removing/
    

    or a specific file

    git update-index --assume-unchanged config/database.yml
    

    Ignore modified (but not committed) files in git?

    Beware: The suggestion above for deleted files when you do a "git commit -am " includes the deleted file!

    A solution that would work for me is to instead of deleting the file, just make it's content blank. This is what I used to mute a .htaccess file.

提交回复
热议问题