1

I'm just learning how to use Git, and somehow by mistake I've patched files and couldn't figure out how to remove them.

When I type $ git status it shows me the patched files which I don't want.

I've tried using $ git apply -R <patch> and it still won't work.

This is what appears when I type $ git status :

enter image description here

torek
  • 448,244
  • 59
  • 642
  • 775
Saud Alghamdi
  • 149
  • 1
  • 9
  • https://stackoverflow.com/questions/61212/how-to-remove-local-untracked-files-from-the-current-git-working-tree – GrafiCode Aug 03 '21 at 01:11
  • Note that these files are *not in Git*. They are not in your *repository* at all; they are in your *working tree*. Note also that the `.rej` files contain parts of the patch that failed: pay close attention to what did not make it in! – torek Aug 03 '21 at 04:53

1 Answers1

0

Create a file named '.gitignore' in the same directory as .git is.
Type in -

*.patch  
*.patch.orig   
*.patch.rej

as the content of the file.
When you run
$ git status
again, you will not see them any more.

Sherman Chen
  • 174
  • 9