Recursively Search File and Delete Them

By Jimmy Bonney | October 15, 2012

Recursive windows

When conflicts occur when merging files with GIT, some temporary files with the .orig extension are created.

One can easily add the *.orig extension to the .gitignore file so that these files are not commited to the remote repository. However, once the conflicts are solved, the files remain in the project directory. This is obviously not a big deal but it might result in unwanted matches when doing a global search on the project for instance.

In order to delete those unwanted files, one can simply run the following command from the project root folder:

1
find . -name '*.orig' | xargs rm

The first part of the command (find . -name '*.orig') find files ending with *.orig extension in the current folder and all subfolders while the second part (xargs rm) remove them.

It is also possible not to save .orig files when resolving conflicts. To do so, simply config GIT to not take backup of conflict files:

1
git config --global mergetool.keepBackup false

For the time being, comments are managed by Disqus, a third-party library. I will eventually replace it with another solution, but the timeline is unclear. Considering the amount of data being loaded, if you would like to view comments or post a comment, click on the button below. For more information about why you see this button, take a look at the following article.