How to make Github magical
UPDATE: I wrote a lightning talk based on this blog post; slides are here!
More often than I should probably admit, I think about magic.
Specifically, how our perception of what is "magic" has very little to do with what's actually magical. If we grew up in a world with magic wands, for example - if they were an everyday, ordinary thing - we'd probably view them the way we view remote controls, and take them for granted. The expected rarely feels extraordinary.
On the other hand, you read about groups of people living in remote places who are exposed to current technology in one fell swoop and process it as a deity, something supernatural. Which makes perfect sense: being able to fly across the world in a plane is undeniably magical.
What other modern routines or capabilities do we take for granted, when they'd be seen as magical in any other context?
For example, programming always feels just a little bit like magic. You use words in a certain place in a certain way in a certain order and Poof! You've created something visual and experiential that anyone anywhere in the world can access.
Programming is basically a variation of spellcasting, but with computers instead of cauldrons.
It's magic in the vein of The Magicians Trilogy - unlike a lot of fantasy novels where humans wield magical powers, casting spells in Lev Grossman's books is crazy difficult. It requires mathematical calculations, scientific reasoning, dexterity, memory ... it's not just waving a wand and saying "Alohomora!"
That being said, when I realized I could use git aliases to make programming more literally (and literarily) magical, I ended up using, well, "alohomora"; it turns out that the Harry Potter fandom maintains a meticulous online dictionary of every spell ever used, and it was too easy to pass up.
Let's get to it.
How to set up aliases
First, open your git config file:
Under [alias], add your "spell words" of choice. Here are mine, for example:
accio = pull
alohomora = checkout
avada-kedavra = branch -d
engorgio = merge
erecto = add
expelliarmus = push
epoximise = commit -m
reparo = commit --amend
revelio = status
lumos = diff
reparifarge = checkout master -- db/schema.rb
How to use them
The same way you would any standard
To delete a branch, for example:
git avada-kedavra name-of-your-branch
Why I picked those spellwords
Here's the rationale behind my choices; definitions courtesy of the Harry Potter wiki.
- Accio: Summoning charm (because I'm summoning code from Github)
- Alohomora: Used to open doors, like opening a door into a Github branch
- Avada kedavra: Killing curse (because you're killing a branch)
- Engorgio: Engorgement charm (because merging oftentimes increases the size of the base code)
- Erecto: "Used to erect a tent or other structure" - this one was a bit of a stretch, but it was the best I could do. When you add code, it's like you're erecting a new part of a structure (the branch) ... right?
- Expelliarmus: Used to make an opponent's wand shoot away from them, like shooting code away from your local computer and up to Github
- Epoximise: "Adheres one object to another, similarly to if they had been glued together" - as in gluing the commit message to the code you're committing
- Reparo: Mending charm (for when I need to mend a faulty commit message)
- Revelio: "Used to reveal concealed objects," as in the files that have been changed since your last commit
- Lumos: A charm to turn a wand into a flashlight - a flashlight that shows specific code changes
- Reparifarge: "Used to reverse unsuccessful transformations" <-- THAT. I use this for when I run database migrations that I didn't write in Rails and it puts a new date on the schema file.