Git: how to exclude a subfolder in a repository?

前端 未结 1 641
刺人心
刺人心 2021-02-05 22:48

I have created a repository in a folder with my project, you know, git init, I have the Webstorm folder .idea and another one not related to this, I am

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 23:26

    Open the .git/info/exclude file in a text editor and add the folder to ignore. This file remains private to you. You can also create a .gitignore file in the repository's root directory, outside the .git directory and write the folder entry there. Then add this file to the repository to share with others what content should be ignored, should others have this directory-to-ignore in their repository too.

    If you already committed this directory then just remove it with git rm -r --cached, commit the deletion and mark the directory ignored as I described above. You might want to make a backup of the directory before you wipe it.

    0 讨论(0)
提交回复
热议问题