Skip to content

Instantly share code, notes, and snippets.

View srsholmes's full-sized avatar

Simon Holmes srsholmes

View GitHub Profile
@srsholmes
srsholmes / grecent.sh
Created November 23, 2023 15:58
Recent git branches
function grecent() {
local branches branch
branches=$(git branch --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]') \
&& branch=$(echo "$branches" | fzf --ansi) \
&& branch=$(echo "$branch" | awk '{print $1}' | tr -d '*') \
&& git checkout "$branch"
}
@srsholmes
srsholmes / gist:7e542686402f50e740ff5f7d5c1278d9
Created October 13, 2022 12:13
Git add, commit and push all in one line.
function p() {
bnch=$(git branch | grep \* | cut -d ' ' -f2)
git add . && git commit -m "$1" && git push -u origin $bnch
}
# Usage: p 'here is a commit message'
#!/bin/bash
# Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# oh my ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@srsholmes
srsholmes / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console