As cqlengine has picked up in popularity, so has my need to review pull requests. Here’s the git alias that I’m using:
[alias] pr = "!f() { git checkout -b pr_$1; curl https://github.com/cqlengine/cqlengine/pull/${1}.patch | git apply -3 - ; }; f " To use, you simply git pr 51 or whatever the pull request is.
Here’s what it’s doing:
Creating a branch pr_[pull request number] Pulling down the patch Piping the patch to apply.
git
- Here’s a pretty common git error message if you’ve added a remote origin server manually. You asked me to pull without telling me which branch you want to merge with, and ‘branch.master.merge’ in your configuration file does not tell me, either. Please specify which branch you want to use on the command line and try again (e.g. ‘git pull ‘). See git-pull(1) for details. Well, fortunately it’s pretty easy to fix.
- There’s an overwhelming amount of git tools, and if you’re coming from SVN you might expect that the tools w/ the same names work the same way. You’d be wrong. Because of Git’s distributed nature, you can (and frequently do) have commits in your repo that you might not have pushed up. You might also have forgotten what they were. Good thing there’s a tool to check that. Lets assume you’re on your master branch, and you’re comparing against the origin remote repo.
- Useful stuff. git filter-branch -f --index-filter 'git update-index --remove filename' HEAD git push --force --verbose --dry-run git push --force Slight better version. Only rewrites history from the first commit the file existed. git filter-branch -f --index-filter 'git update-index --remove filename' <introduction-revision-sha1>..HEAD git push --force --verbose --dry-run git push --force Found on github.
- Here’s a great guide for setting up a new remote git repo. Thank you, Tool Man Tim.
- I’ve been using SVN for several years now, so I’ve been partial to it, and reluctant to switch to another form of source control. I’m very comfortable with it, and I’ve got dozens of scripts to augment it and help me deal with it’s shortcomings, as well as a few blog posts. Easier to create a repository from existing code. This is the first thing I noticed about git that absolutely crushes subversion.