Skip to content

Instantly share code, notes, and snippets.

@reinier
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinier/5674c83a4de81e9cf7f7 to your computer and use it in GitHub Desktop.
Save reinier/5674c83a4de81e9cf7f7 to your computer and use it in GitHub Desktop.
Handy terminal functions
# Functions for handy stuff
# Create a new directory and enter it.
# Example: `mkd new-dir`
function mkd() {
mkdir -p "$@" && cd "$@"
}
# Init a git repository and commit everything inside.
# Example: `initcommit`
function initcommit() {
git init && git add . && git commit -m 'First commit'
}
# Bootstrap a repository from an online repository.
# Hidiyo, let's go! — https://www.youtube.com/watch?v=PQzOrjpXyNs
# Examples:
# - `hidiyo website.dev`
# - `hidiyo blog.dev wordpress/wordpress no`
# $1 = Directory for project
# $2 = Repository on github to clone - Default is `reinier/static-website`
# $3 = Init a git repo or not? - Default is `yes`
function hidiyo() {
if [ $2 ]; then repo=$2; else repo='reinier/static-website'; fi
mkd "$1" && git clone git@github.com:$repo.git ./ && rm -fr .git
if [ -z $3 ] || [ $3 = "yes" ]; then
initcommit
# Do this yourself:
# `git remote add origin REMOTE-URL`
# `git push origin master`
fi
}
# Get an overview of your work from yesterday inside a Git repo. /ht @marcohamersma
# Example: `standup`
function standup {
if [ $1 ]; then dayno=$1; else dayno='1'; fi
git log --author="Reinier Ladan" --since=$dayno.days --until 06:00 --all --reverse --format="%Cblue%h%Creset %s %Cgreen %cr" | cat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment