Skip to content

Instantly share code, notes, and snippets.

@jweakley
jweakley / gist:1a7aa993ba5219bbd27d
Created June 25, 2015 19:58
How to get all staged git files in ruby
# Using No External Gems
`git diff --name-only --cached`.split(/\n/) # Returns all files as array of relative paths
@jweakley
jweakley / .gitconfig
Last active September 18, 2025 17:25
Macbook Home Directory Files
[alias]
# adds everything and commits
ac = !git add -A && git commit
# adds everything and ammends it to the previous commit
amend = !git add -A && git commit --amend --no-edit
# pretty branch list
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
# creates a new local branch and sets it up with origin
create-branch = !sh -c 'git push origin HEAD:refs/heads/$1 && git fetch origin && git branch --track $1 origin/$1 && cd . && git checkout $1' -
# creates a local branch and removes it on origin