Delete .orig files after Git merges using a PowerShell function

I had to resolve merge conflicts for a few commits today after rebasing my current work. Each time I resolved the merge a pre-merge version of the file was left (with the .orig file type) and by the second merge I was over having to remove that file manually afterwards.

I wasn’t entirely sure why the files are left as I do have mergetool.keepBackup configured to false and while doing some research I found kghastie’s solution on StackOverflow. I adapted that to the PowerShell function below.

I’ve set this up in my PowerShell user profile so now all I need to do is run git-rm-orig and I get prompted to delete any .orig files in the repo. Thanks kghastie for the solution!

Advertisements
Delete .orig files after Git merges using a PowerShell function

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s