It is IMPORTANT to note that you MUST COMMIT ALL PREVIOUS CHANGES BEFOE CONTINUING
-
Remove everything from Local Repo
git rm -r --cached .or if you are untracking a specific file(s)git rm -r --cached name_of_file -
Add back all untracked files you need
git add .orgit add name_of_file_with_fix -
Commit Changes
git commit -m "untrack name_of_file fix" -
Push changes to remote repo
git push
If you have any questions, do not hesitate to contact me on social media.
Happy coding 😄, --Maya
hi @ArthurV7 Well, you are not technically telling git the specified file is untracked. What you are doing is removing it from staging tree without removing the file from the system. If you use the command like so:
git rm -r --cached .it would remove all files from the staging area that have not pushed to the repository and if you specify the file it'd only remove that file. That could then allow you re-add and add a new commit message or add it to your .gitignore after removing it from the staging tree in git.If anyone knows a better way to do this, please do let me know! Feel free to add me on github, you can also email me at mayacdouglas@gmail.com