tRuEsAtM
tRuEsAtM

Reputation: 3668

How to remove (not ignore) specific files using .gitignore?

Below is the image of my project structure:

enter image description here

I would like to delete .vs folder, packages folder, .hgignore file and bin and obj directories under Leapfrog.Datafetcher, Leapfrog.Test, and src/LeapfrogDataService.

As of now, my .gitignore file looks like

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
packages
.hgignore

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/

Can anyone let me know what is missing in a .gitignore file or is there anything wrong with my path?

Upvotes: 2

Views: 4794

Answers (1)

Dan Lowe
Dan Lowe

Reputation: 56488

.gitignore will not delete anything. All it does is ignore certain paths when you are trying to git add or git commit. If the files are already being tracked by git, adding them to .gitignore will prevent you from making further changes (in git) to those files, but it won't delete existing history.

If you want to remove these files from your repository, you need to use git rm (or git rm -r to recursively remove a directory and its contents).

Upvotes: 2

Related Questions