Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Validate the input
if [ "$#" -ne 1 ]; then
printf "Enter a branch number only\n"
exit
fi
# Special case if the argument is "-"
if [ $1 = "-" ];
@dominic-rossi
dominic-rossi / prepare-commit-msg
Created July 13, 2017 22:41
Add the current branch name to the beginning of commit messages
#!/bin/sh
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
firstLine=$(head -n1 $1)
if [ -z "$firstLine" ] ;then #Check that this is not an amend by checking that the first line is empty
sed -i "1s@^@$branch_name: \n@" $1 #Insert branch name at the start of the commit message file

Keybase proof

I hereby claim:

  • I am dominic-rossi on github.
  • I am drossi (https://keybase.io/drossi) on keybase.
  • I have a public key ASAZYPf_pTIxJaRmT5Fs0czF8y0vJ8eLyZluS34EyAtXpwo

To claim this, I am signing this object:

@dominic-rossi
dominic-rossi / .zshrc
Created September 29, 2020 23:19
~/.zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%m %{$fg[magenta]%}%1~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history