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.

Community
  • 1
  • 1
Aharon Manne
  • 712
  • 3
  • 11
  • 34

2 Answers2

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

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 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 Mar 15 '16 at 07:30
  • Where do you see ** in the OP? there is only *.obj in the question – CodeWizard Mar 15 '16 at 16:31
  • I did not say that there is ** in the original post. – 1615903 Mar 16 '16 at 05: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. – Filipe Madureira Dec 03 '19 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?

Aharon Manne
  • 712
  • 3
  • 11
  • 34
  • 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 Apr 04 '16 at 07:59