Franck Dernoncourt
Franck Dernoncourt

Reputation: 83437

Ignore files that have already been committed to a Git repository in GitHub for Windows

In GitHub for Windows, is there any way to ignore files that have already been committed to a Git repository, aside from switching to the Git shell (git rm --cached filename to ignore, git add filename to undo ignore)?

Upvotes: 0

Views: 57

Answers (1)

LuVu
LuVu

Reputation: 1088

Git can only ignore files that are untracked - files that haven't been committed to the repository, yet. That's why, when you create a new repository, you should also create a .gitignore file with all the file patterns you want to ignore.

How to make sure your files are ignored:

$ git rm -r --cached .
$ git add .
$ git commit -m "Clean up ignored files"

For more information on how to ignore files: https://www.git-tower.com/learn/git/ebook/en/command-line/basics/starting-with-an-unversioned-project#start

Upvotes: 2

Related Questions