-2

Ok, so I'm new to git. I've just created a project, initialized it as a repository and linked it to bitbucket. I'm using NetBeans, and whenever I create a project with NB, it includes a directory called nbproject. I added the directory to .gitignore but the thing is, when a collaborator clones the repo, NB doesn't recognize it as a project because of the missing nbproject folder. Now, this folder, because is specific to each developer, shouldn't have changes tracked. Even when I tried to clone the repo from my laptop I couldn't open the project (I had to copy the nbproject folder from another project into the cloned repo and this is a waste of time). How can I initially push a directory so everybody can open the project without problems but then not track its changes? Sorry for my english. Also, if you could recommend a book, course, tutorial or any resource to learn git, that would be really helpful, thanks. EDIT: I also read that if i write to .gitignore myfolder/ then it will ignore all folders with that name at any level. What if i want a specific myfolder folder to be ignored?

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
Johnny Beltran
  • 701
  • 2
  • 8
  • 22
  • Git doesn't store directories at all. It stores commits, and commits have files, and files live inside directories; so Git will *create* a directory, if it must, in order to put a file there. This means you must force Git to commit *some* file within that directory, in order for Git to create that directory on its own. You can always create the directory yourself, not using Git at all; or see the duplicate. – torek Nov 04 '17 at 21:53

1 Answers1

-1

You can explicitly add a file by git add. Add it using this command so it will be added and won't be tracked by other users when committing since it's in .gitignore

Ignited
  • 771
  • 3
  • 7
  • 21