freeCodeCamp/guide/english/miscellaneous/untrack-files-previously-co.../index.md

22 lines
517 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Untrack Files Previously Committed from New Gitignore
---
To untrack a _single_ file, ie stop tracking the file but not delete it from the system use:
`git rm --cached filename`
To untrack _every_ file in `.gitignore`:
First **commit** any outstanding code changes, and then run:
`git rm -r --cached`
This removes any changed files from the index(staging area), then run:
`git add .`
Commit it:
`git commit -m ".gitignore is now working"`
To undo `git rm --cached filename`, use `git add filename`