0%

Git LogoIf I ever start at a new job where I'm given a new Mac I always set up these aliases. I'll list them with their output then at the end provide a gist of them you can add to your own aliases.

If you're on a Mac with OSX then you will find your aliases in ~/.gitonfig

You can add aliases with the following example:

$ git config --global alias.co checkout

Without further a...oh sod that cliche. Here's my aliases:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a = add
b = !git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'
c = commit -m
cob = checkout -b
devs = shortlog -n -e -s
ds = diff --staged
l = log --graph --pretty=format:%C(yellow)%h\ %ad%Cred%d\ %Creset%s%Cblue\ [%cn] --decorate --date=short
ll = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold yellow)— %an%C(reset) %C(bold blue)<%ae>%C(bold red)%d%C(reset)' --abbrev-commit --date=relative
panic = !tar cvf ../git_panic.tar *
rao = remote add origin
s = status -s
tidy = !git gc && git clean -dfx && git stash clear
undo-commit = reset --soft HEAD~1
wdiff = diff --word-diff=plain
who = shortlog -n -e -s

Here's a gist of my current aliases:

If you're anything like me and have a problem with names - not just people - but projects too. Or if you find yourself losing track of projects because of different languages or editors used.

You may find your saviour in the tmux + tmuxinator combo.

When discovering virtualenvwrappers workon command for managing Python projects I was immediately envious of it's functionality; wishing it was available for other projects.

I wanted a similar app that could launch prepared editor environments. While being flexible enough to change editor on a whim. I often switch between Vim, Sublime and Atom depending on mood and weather. If I'm feeling especially masochistic I'll setup a project in PHPStorm (leave hate mail below).

Next, something that could store my code locations as I had several. Including ~/Dev ~/Development ~/Sites - don't ask me why. But also remote locations accessible only via FTP, SSH or some other arcane method.

Now with anything from 2 big to 20 small projects on the go for work and around 20-30 small home/hobby projects its not suprising I got muddled.

In my idle wandering I came across the aforementioned tmuxinator which ticked ALL the boxes using a tool I already used (tmux).

# tmux

tumx is like Screen but 10x better. If you're still using Screen then switch to tmux. If you've never heard of Screen then...pretend I said nothing and use tmux!

tmux enables you to save multiple virtual consoles. In a basic way it can help you save your place in an terminal session. This is great for unstable SSH connections. If the session dies then normally you lose everything including spawned processes, etc.

But if you were in a tmux session then its all saved as ts all executed from the tmux process. tmux becomes more profound as you use it. When you combine it with Tmuxinator you suddenly realise you are capable of taking over the universe (or something similar)

# Tmuxinator

Tmuxinator gives you all the power of Tmux but with configurable states. So you're no longer restricted to just saving your last state said but you can set up your own states. Your terminal, and to an extent your system, can be setup for a particular project.

tmux and tmuxinator gives unlimited power

Put another way it gives you that workon used in Python I mentioned earlier with unlimited power.

Imagine you have my hobby project-nest and you are wondering what to do today with your 30+ hobby projects. Do you want to spend 10, 20, 30, 60, minutes hunting for the one you last worked on about 6 months ago whose name began with p?

Oh god you're sure it was in that folder with other Node experiments maybe or?

You don't have to remember once you've set up a tmuxinator config file in YAML.

All it takes then is:

1
2
3
4
% mux list

tmuxinator projects:
awin-feeder fspart myblog ukp

And all it takes is mux open myblog to open up that project.

Here's an example of the tmuxinator project file for this blog:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
name: myblog
root: /Users/doug/Sites/dougbromley/blog

windows:
- editor:
layout: main-vertical
panes:
- subl --project myblog.subliime-project; clear
- hexo --help
- genwatcher:
layout: main-vertical
panes:
- hexo generate -w
- hexo serve
- gitstats:
layout: main-horizontal
panes:
- git ll
- git cal
- git summary

In the above its:

  1. Opening the a basic vertical layout
  2. Then in the main pane its opening Sublime with my blog as the main project so I can start editing straight away.
  3. In a separate pane the hexo help command is run to remind me of hexo's commands.
  4. In another window the hexo local server is run.
  5. In that same window another pane with hexo generate is run with the watch flag so I can see changes regenerated live.
  6. In the final window is a set of panes giving some git info - I often find this useful to remind me where I left the project.
Session Screenshot of Window gitstats

In the past all of these sequences and processes would have to be remembered but if you have multiple projects it can become a burden to remember them all.

Tmuxinator along with tumx makes things much simpler.

If you’re a Windows user then you’ve likely come across Sysinternals at some point during your time. Although a lot of people may know of it not everyone uses it to its maximum potential.

If you’ve ever been in a position with a unexplainable BSOD, unhelpful error dialogs, then check out Mark Russinovich’s “The Case of the Unexplained” webcasts where he’ll give tips on figuring out what dialogs like these actually mean:

Outlook Express Dialog

Anyway you don’t actually need to download the tools as they have been made available as a share at \\live.sysinternals.com\Tools\

So you can add them as a network drive for easy access

Found this interesting video on whether older programmers can still be relevant. A good question considering I'm now in my thirties and Mark Zuckerberg famously said:

"If you're over 30, you're a slow old man" ~ Mark Zuckerberg

(at the time of writing Mark Zuckerberg is 32yrs old - the same age as me)

Along with a string of other similar statements from Zuck and major people at Intel, etc.

I wonder if Zuckerberg's opinion has changed since he reached 30?

Anyway on to the video which I think hits the nail on the head:

tldw; Basically if you don't keep up with the trends you will become a dinosaur. But that goes for everyone in every industry.

Thankfully I'm pretty comfortable embracing new technologies! In fact I'm obsessed with checking out new tech and that obsession doesn't seem to be abating anytime soon.