Skip to content

Instantly share code, notes, and snippets.

@kidpollo
Created March 4, 2011 18:35
Show Gist options
  • Save kidpollo/855456 to your computer and use it in GitHub Desktop.
Save kidpollo/855456 to your computer and use it in GitHub Desktop.
Useful git commands
#make a new branch that tracks remote branche
git branch --set-upstream foo upstream/foo
#list the files modified on the last 10 commits and filter only spec files
git diff --name-only HEAD~10 | egrep _spec\.rb
#difference between the state of the file from 3 commits in the past
git diff HEAD~3 -- app/views/topics/merges/_new.html.haml
#run specs modified on the last 10 commits
spec `git diff --name-only HEAD~10 | egrep _spec\.rb`
#prune repos that where removed on remote
git remote prune origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment