Skip to content

Instantly share code, notes, and snippets.

View ColinRyan's full-sized avatar

Colin Ryan ColinRyan

  • St. John's, Newfoundland, Canada
View GitHub Profile
@ColinRyan
ColinRyan / makeAliasFromLastCommand.sh
Last active April 14, 2022 22:32
bash snippets for working with aliases
# Requires bash, history, tail, cut, echo, and sed (if you have bash you probably
# don't need to install anything).
# Takes a alias name and gets the last command from the history. Makes it an
# alias and puts it in .bash_aliases. Be sure to source .bash_aliases in .bashrc
# or this wont work.
makeAlias()
{
if [ $# -eq 0 ]; then
echo "No arguments supplied. You need to pass an alias name"
@ColinRyan
ColinRyan / g.sh
Last active December 15, 2016 17:58
automation of a common scenario that occurs when dealing with pull request reviews
# 1) Pick a branch ($1)
# 2) stash
# 3) checkout
# 4) updated files from last commit
# 5) commit and push if new edits made
# 6) back to previous branch
# 7) pop stash
g () {
cd $(git rev-parse --show-toplevel)