Today I did git pull when I really wanted to git merge --no-ff. Uh-oh. Luckily for me the fix was pretty easy. I just did git reset --hard and it worked out well because I hadn’t done any work since the last push. That meant the local and remote branches were pretty close, so I wasn’t undoing any work.
Just in case you do have more local commits that you want to save you can use git reflog to find the hash of the commit you want to revert to. Then you can run git reset --hard <whatever hash you selected above> And voila! You are back in business.
I’m still tweaking my screen layout in vscode a lot. One thing I really don’t like is that the terminal has to be fixed to the bottom. That means I can’t get much height out of it unless my code window is tiny. I played with turning my monitor, but that felt pretty bad for my neck and didn’t make me feel better about my layout. Last week I stopped using the vscode terminal and started using iTerm again. That was better, but now I needed to use my mouse or a bunch more shortcuts in order to switch to iTerm, press up to get the previous command, and then switch back to the code to start fixing. Then today I had a good idea!
It’s really simple: I set up an automator task that switches to iTerm, presses the up arrow, and then presses enter. I set the shortcut to be command f3, so now I can run my tests without taking my hands off the keyboard (and in one shortcut!) I also had to make sure vscode wasn’t using that shortcut. This is written in a funny little scripting language called applescript. It’s been baked into osx for forever and it’s fairly readable.
Now while I’m doing red-green-refactor I’m able to save time with fewer clicks. It’s a tiny example of ‘automating toil’, but it makes me smile whenever I save a second.
This is my blog. It’s a way to put up the new things I have learned, and to remember the things I have forgotten. If you’re looking for some of my backstory, here is my blog about my journey into software engineering.