Last active
August 29, 2015 14:17
-
-
Save reinier/5674c83a4de81e9cf7f7 to your computer and use it in GitHub Desktop.
Handy terminal functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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