2

I have a solution with two projects in VS 2015, and I want to remove the obj and bin directories from version control.

From the beginning, my .gitignore has the following:

[Dd]ebug/
[Rr]elease/
[Bb]in/
[Oo]bj/
*.obj
*.exe

When I follow the advice in this question and this one and this one, the files are removed.

But the next time I compile, they are added to the project again.
What am I doing wrong, and how can I get rid of those directories permanently?

Edit

To be clear, the question relates to the git interface offered within VS2015.

0

2 Answers 2

1

...obj and bin directories from

you have to specify it as folders (starting with the /)

**/[Bb]in/
**/[Oo]bj/

I have created a bin folder and then added it to the .gitignore as showed above. As you can see the changes are in the .gitconfig in which i added the changes but bin folder is not in the status anymore.

Here are the results: enter image description here

4
  • That is not correct, the syntax OP is using works fine. ** annotation just makes git ignore the folders in any depth, not just the same folder where the .gitignore file is.
    – 1615903
    Commented Mar 15, 2016 at 7:30
  • Where do you see ** in the OP? there is only *.obj in the question
    – CodeWizard
    Commented Mar 15, 2016 at 16:31
  • I did not say that there is ** in the original post.
    – 1615903
    Commented Mar 16, 2016 at 5:30
  • This is incorrect. The trailing / is used to identify a folder. The leading / just makes .gitignore look in the root folder for the given folder name, thush adding **/ is the same as not using anything leading at all. Commented Dec 3, 2019 at 11:06
0

After committing on the command line, the problem seems to have gone away. I'm not sure that this is the answer. I am fairly sure that Visual Studio does all sorts of things behind the scenes with git. Is there any documentation of how the VS front-end for git works?

1
  • 1
    you never said in the question that you're not using the command line. This is relevant information to be added to the question itself.
    – eis
    Commented Apr 4, 2016 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.