Proficiency with Terminal and Git


I've recently picked up an amazing Terminal shortcut: ^ + R. Gone are the days of hitting up arrow a bunch of times to get to a previous command. This little shortcut will let you search through your recent commands. Just start typing what you want and it pop it shows up.

Random Git commands

I recently watched Zach Holman's Git and GitHub Secrets and it had a bunch of great nuggets. It helps to be able to go back through his slides. Here are some of my favorites.


Add ?w=1 to any url to ignore whitespace is github's url shortner. Check it out

Gists are repos

Using hub you can push to multiple remotes: hub push origin,staging

? in github to see all shortcuts

Search commits by author: ?author=holman

I always forget this URL: Emoji


Commitless Commits: git commit -m "..." --allow-empty

Staging parts: git add -p

Search commits: git show :/query

Go back to previous selection: cd -, git checkout -

See which branches have been merged into current: git branch --merged

See which branches have not been merged: git branch --no-merged

See which branches contain a commit: git branch --contains 838ad46

Copy file without switching: git checkout branch -- path/to/file.rb

git commit --amend -C HEAD - alias this!

git reset --soft HEAD^ undoes the last commit and puts it on staging

There are a bunch more, so watch the video.

source Git and Github Secrets