Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] Lazarus Pascal - Git - How to make a clean patch file (Diff) by excluding certain files
Delphi, Lazarus, Free Pascal
(@hans)
Famed Member Admin
Joined: 13 years ago
Posts: 3098
Topic starter
May 19, 2026 12:13 PM
Making a modification I learned how to exclude certain files when making a patch file (thanks n7800!).
Normally one would use
git diff > todo.patch
But with Lazarus Pascal this would come with unwanted PO and POT (translation) files, and (under macOS anyway) lazarus.app and startlazarus.app (exclude sections).
Sometimes it also coms with unwanted white space which we'd like to exclude as well (-w option).
All options together this would make
git diff -- . ':(exclude)*.po' ':(exclude)*.pot' ':(exclude)lazarus.app' ':(exclude)startlazarus.app' -w > mychanges.patch
Running this in the Lazarus directory will create a nice and clean Diff file (for small changes).
Hope this is useful for others, at least a nice reminder for myself.