I have already committed my whole Visual Studios project to my Git repository. However, I realized that I didn't include a gitignore file until after I committed my project. I think this is causing problems since I've pushed some of the files that are compiled. My main problem is that my gitignore
is not ignoring files such as .dll
and .pdb
.
How can I fix this? Should I remove my whole project and recommit with the new gitignore
? or are there specific visual studios folders I can just remove?
.gitignore
ignores only those files which are not being already tracked with git. Since you already added the .dll
files, they won't be ignored on their own now.
You can remove specific folders/files from your repo using git rm
git rm -r --cached folder_1
git rm -r --cached folder_2
git rm --cached file_1
git commit -m "removing unwanted files"
The -r
above is for recursive removal of folders.
However, that will leave a commit history having all those files.
So, if you haven't pushed it upstream already, and have made fairly low number of commits till now, I would recommend creating a new repo - Delete the .git
folder, and then run git init
, then create/update the .gitignore
file with the right entries, and finally add your code again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.