git-friendly is a collection of shell scripts for automating basic git workflows I find myself typing over and over again.
The goal is to make pulling, branching & merging fast and painless.
Git is super powerful but forces you to type 2 or 3 commands just to do some super basic tasks. This package adds some new commands: pull, push, branch and merge — which are just wrappers around a few git commands & other callbacks
These commands have some bonus niceties like:
- push also copies a GitHub compare URL to your clipboard for easy pasting (!)
- pull will run commands like “bundle install” after finishing
- branch will setup both local & remote branches as needed
- relevant commands will stash/pop changes as needed
- less time fighting git = more time actually doing work
Run this one-liner, which will checkout the latest code & unpack the scripts into
If you don’t have write access to
/usr/local/bin you’ll need to run it as a user who does, eg. root.
bash < <( curl https://github.com/jamiew/git-friendly/raw/master/install.sh)
In case you want to keep things out of
/usr/local/bin. Checkout the code:
git clone git://github.com/jamiew/git-friendly.git ~/dev/git-friendly
Then add this directory to your PATH:
Add this to your
~/.bash_profile so that it runs each time you launch a new shell:
echo "export PATH=~/dev/git-friendly:$PATH" >> ~/.bash_profile source ~/.bash_profile
You now have some awesome new commands: pull, push, branch, merge
$ pull $ branch awesomeness $ echo "BUMP" >> README $ git commit -a -m "Righteous bump" $ git checkout master $ merge awesomeness $ push
|pull||Stash any local changes, pull from remote using rebase, pops your stash, and re-bundles if necessary|
|push||Push your changes to the remote + copy a sexy diff URL like http://github.com/jamiew/git-friendly/compare/e96033…5daed4 to your clipboard. This only works on Macs, but boy is it sweet.|
|branch [name]||Switch branches or create new local and/or remote branches as needed. Intelligently sets up remote tracking, so you can just type ‘git pull’ and not always ‘git pull origin newbranch’. If no argument specified will list all local & remote branches.|
|merge [name]||Merge the specified branch back into master. Rebases first if the branch is local-only|
Bonus: Pimp Your Configs
I strongly recommend making some basic upgrades to your ~/.gitconfig to add chill features like ANSI color, command shortcuts, rebase-by-default, automatic remote tracking & more. Example: my ~/.gitconfig
I also highly recommend adding the current git branch to your Terminal prompt (PS1) or you’ll quickly lose your mind — here is pimp_prompt() for bash which goes in your
~/.bashrc. Then type
source ~/.bashrc to reload.
Code released under an MIT license… fork away, do whatever, pull requests welcome!