If I understand right, in order to "ignore" a file so it won't come up when I type git status or git add -A I need to add it to the .gitignore file.
My goal is to ignore a certain folder and file when committing changes to Git, permanently.
I tried editing the .gitignore file in my editor:
config/
src/package.xml
I saved the file, committed and pushed to Git, refreshed my project from another repository, typed git status and still saw the xml file and the folder.
Also tried using GItHub Desktop by choosing "Discard Changes", it automatically added to .gitignore the following lines:
*.sublime-workspace
config/.local_store
*.sublime-workspace
src/package.xml
but same result...
Project Structure:
Full
________|____________
| | |
config .gitignore src
| |
... package.xml
.gitignore doesn't apply retroactively. It is read by git add only when a file is added for the first time to the repo.
If the file is already in the repo, listing it in gitignore is not enough. You also need to remove it from the repo (git rm --cached src/package.xml).
Don't forget to git add .gitignore and git commit, in order to persist the changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With