2

For this example, I made a structure like this:

touch ron .gitignore
echo generated-file > .gitignore
git init
git add . && git commit -m"Initial commit"
touch generated-file
echo modification > ron
touch untracked-file
git status --ignored=matching

So in my working tree, I have this generated-file file.
To "reset" my repository, I can remove the directory and clone the repository.

Is there a command that does the same?

I tried combinations of git rm $(git status --ignored=matching).

Ron van der Heijden
  • 14,803
  • 7
  • 58
  • 82

1 Answers1

2

git clean -f -X is the best command for doing that. Fully explanation is here. https://git-scm.com/docs/git-clean. Ensure you dry run before running the command.

Rmahajan
  • 1,311
  • 1
  • 14
  • 23