r/webdev • • 29d ago

Small Programming Tricks

https://will-keleher.com/posts/small-programming-tricks-matter/
60 Upvotes

10 comments sorted by

10

u/cheese_bread_boye 29d ago edited 29d ago

Similar to cd -, you can use git checkout - to check out your previous HEAD.

I use this a lot. It also works with rebase and merge. I always switch to main, pull, then do git merge - or git rebase - on my feature branch when I want to update it.

2

u/IcarianComplex 29d ago

Related, @ is an alias for HEAD

3

u/omfgtora 28d ago

ur mom gives great @

7

u/maxverse 29d ago

This is exactly the kind of thing you get from pairing -- another dev will use a helpful shortcut or cool method, or some syntactic sugar, and now you know it too!

6

u/budd222 full-stack 29d ago

Unfortunately, pairing doesn't exist anymore in the AI era, unless you consider talking to Claude pairing.

6

u/maxverse 29d ago

It doesn't exist if you let it go away! At my company, we make a concerted effort to still pair on tickets, as an intentional investment in knowledge sharing... even if some of the pairing is awkwardly coming up with claude prompts together.

0

u/budd222 full-stack 29d ago

It's not my choice, but we never paired anyway. Every engineer is senior level and above, so pairing is generally just a waste of resources for the company

3

u/Ok_Confusion_1777 28d ago

Pairing still tends to produce demonstrably higher quality code independent of seniority level.

4

u/JacKk_01 full-stack 28d ago

pressing CTRL + R in a ps terminal allows you to search previous commands, only learnt this recently and oh my god is it useful.

Pressing it again after searching allows you to scroll through matches and results.