0

'nuget.exe' is committed in my repo. One of the first thing my build script does is run nuget.exe update -self -NonInteractive.

This replaces nuget.exe with the latest version before my build script starts using it to restore nuget packages.

The problem is that the changed version of nuget.exe shows up in my git changes. I don't want to accidentally commit it, so don't want it to be tracked.

I tried to add nuget.exe to my .gitignore file. But that ends up adding a deletion of nuget.exe to my changes. I don't want to delete the one in the repo, I need it because it can upgrade itself.

How can I stop changes to nuget.exe from showing up?

Scott Langham
  • 58,735
  • 39
  • 131
  • 204
  • Does this answer your question? [Can I 'git commit' a file and ignore its content changes?](https://stackoverflow.com/questions/3319479/can-i-git-commit-a-file-and-ignore-its-content-changes) – 1615903 Sep 23 '20 at 14:29

1 Answers1

0

Ok, I couldn't find a way to specifically ignore changes to the file. But I have a workaround:

Copy the nuget.exe to a /LatestVersion/ subfolder before upgrading it. Then I can ignore the /LatestVersion/ folder using .gitignore and the rest of my build uses that copy of nuget.

Scott Langham
  • 58,735
  • 39
  • 131
  • 204