I don't want my development branch or the Test project of my project in my DevOps project. I pushed everything from my computer when I got DevOps set up. But I didn't think about the test project until it was too late. Now I want to "ignore" the Test project but there is no apparent way to do that. Of course, the project is fully located in the WaterTests folder. So is there a way to tell git to ignore a folder?
Asked
Active
Viewed 82 times
1
-
1Does this answer your question? [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – OSH Jul 28 '20 at 20:16
-
I'm inclined to assume you already have a gitignore because you've tagged your question with it, but in case you haven't, you can refer to [this question](https://stackoverflow.com/questions/10744305/how-to-create-a-gitignore-file?noredirect=1&lq=1) or [this documentation](https://git-scm.com/docs/gitignore) for how to create a gitignore. – OSH Jul 28 '20 at 20:17
-
Can you please add the following info : how your folders are nested (relevant parts of `tree -d project/`), what folders are actually a git repository (contain an immediate `.git/` folder), and the content of your current `.gitignore` ? – LeGEC Jul 29 '20 at 12:26
1 Answers
0
If you want to remove a remote branch, simply run :
git push origin -d branch
# this removes the remote branch, the local one is preserved
To ignore a folder within your project, the most suitable git feature is to use a .gitignore
file.
As described in the answer suggested as duplicate, since the folder is already tracked, you will also need to apply an action to remove it from tracking :
git rm --cached path/to/folder
If you have several branches, you will need to repeat these actions (adding a .gitignore
file and rm --cached
the existing one) on all branches.

LeGEC
- 46,477
- 5
- 57
- 104
-
Thank you for the responses, but I want to ignore the entire test project. On the hard drive it is in a single folder. In visual studio it is a separate project. One project is the program, one project is Unit Testing. I don't need to source control the unit tests. This is not a duplicate question. I already have the .gitignore file, I just don't know how to add the unit test project to it. – ScottinTexas Jul 29 '20 at 10:59
-
The easiest way to ignore the content of a folder : add a `.gitignore` file in this folder, with content `*`. You will still need the `rm --cached` part – LeGEC Jul 29 '20 at 11:37