How I manage DWM patching on OpenBSD using git rebase
These are just notes for me to remember how I manage DWM patching using git rebase. If you find them useful that’s great. Basically we’re going to create 3 branches, master, openbsd and custom. Then we’ll branch from openbsd temporarily into a patch branch, do the patching there and merge everything back into the custom branch using git rebase so that we have a clear linear commit history.
- peace and quiet
Obtaining the source
mkdir github cd github git clone https://git.suckless.org/dwm cd dwm
Branch and do the OpenBSD build change
git checkout -b openbsd vi config.mk # uncomment the OpenBSD line and save changes git add config.mk git commit -m openbsd
Create our custom branch
Now that we have the OpenBSD specific branch we can use that as a basis for customisation. We’ll create a custom branch from where we’ll do the building.
git checkout -b custom echo "util.o" >> .gitignore echo "dwm.o" >> .gitignore echo "dwm" >> .gitignore echo "drw.o" >> .gitignore echo "config.h" >> .gitignore git add .gitignore git commit -m "added .gitignore" # do any minor custom changes here like border pixel width or mod key make clean && make && doas make install git add config.def.h git commit -m custom
Do the custom patching
Now that we have a custom branch, when we want to include a patch we’ll build it in here but we’ll first make a branch from openbsd and call it something like the patch name.
git checkout openbsd git checkout -b noborder git apply <path to patch file> git add <whichever files got modified by the patch> git commit -m noborder git rebase custom git checkout custom git rebase noborder git branch -D noborder make clean && make && doas make install
So at this point we’ve used openbsd branch as the basis for our patching and then brought all those changes into our custom branch and built it.
- master # as cloned from suckless
- openbsd # OpenBSD specific changes and minor mods, based on master branch
- custom # our custom patched version, based on openbsd branch