How could I ignore bin and obj folders from git repository?

后端 未结 9 1279
死守一世寂寞
死守一世寂寞 2020-12-12 13:00

I want to ignore bin and obj folders from my git repository. As I\'ve found out, there is no easy way to do this in .gitignore. So, are there any other way? Using clean solu

相关标签:
9条回答
  • 2020-12-12 13:32

    If you try through source tree and still the ignore files are not coming in , go to tools-->option->Git and then select location of the .gitignore

    0 讨论(0)
  • 2020-12-12 13:35

    @Raphael Pinel is absolutely correct. .gitignore doesn't work if the files are already in the Git repository.

    I'm using VS2019 and Azure DevOps as my Git repository. Here's how I fixed it.

    In Visual Studio, add .gitignore file (if necessary) and push that file to the repository. Team Explorer->Changes->Right Click .gitignore->Stage. Then commit staged, then sync. Go to Azure DevOps website. Delete bin/obj folders from Git repository. In Visual Studio, Team Explorer->Changes->"Undo Changes" to those folders. Team Explorer->Synch->Pull to update local Git repository. You can now build your project and Git will ignore the folders as specified in the .gitignore file.

    0 讨论(0)
  • 2020-12-12 13:37

    If you are using Visual Studio then there is a simple way to do this.

    1. Open Team Explorer
    2. Click on settings
    3. Repository Settings
    4. Under Ignore & Attribute file section Click on Add beside Ignore file.

    It will create a default .gitignore file, which will ignore most of common folders & files that will used by framework/language.

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