TIL git filemode and interactive rebase
I just migrated to a new operating system (windows -> macOS) and have restored the system from my backups. I noticed that I kept losing the executable bits on files in my git repository. As it turns out the repository had filemode set to false (which is the default on Windows, an OS that does not recognize executable bits). Since I did not clone the repo that configuration was kept. So I had to manually set it to ‘true’. After this, I had to re-commit all files with executable bit set and they would stay that way.
Another issues I faced was with the default user being changed. I had set a
global user in my previous config. This time I wanted a local user email for
this particular repository. But I had already made some commits with the old
email. So then I learned about interactive rebase:
git rebase -i.
This is a nifty command that lets you reorder commits, pick and drop commits as
well as edit past commits (over the last one which can always be ammended with
git commit --amend). It is an useful tool to have. But beware: as with all
git commands that rewrite the commit history, do not use after you have pushed
to a remote (and other people potentially pulled from it). That would create a
lot of confusion.