Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Pimp your git workflow. Just type pull, branch, merge, push

branch: master
README.textile

A collection of shell scripts for making pulling, branching, and merging with git fast and painless.

Git sometimes requires typing 2 or 3 commands just to execute something basic like fetching new code. git-friendly adds some new commands – pull, push, branch, merge – which are just simple wrappers around git commands and some post-pull hooks.

Bonus niceties:

  • push also copies a GitHub compare URL to your clipboard for easy pasting
  • pull will run commands like `bundle install` and `npm install` if applicable
  • branch will track remote branches if available
  • relevant commands stash/pop changes as needed
  • less time fighting git = more time actually doing work

Install

Run this one-liner, which will checkout the latest code & unpack the scripts into /usr/local/bin
If you don’t have write access to /usr/local/bin you’ll need to run this using ‘sudo’

bash < <( curl https://raw.github.com/jamiew/git-friendly/master/install.sh)

You can also provide a directory to install as an argument, e.g. /usr/bin instead of /usr/local/bin:

bash < <( curl https://raw.github.com/jamiew/git-friendly/master/install.sh /usr/bin)

Advanced Install

Checkout the code:

git clone git://github.com/jamiew/git-friendly.git ~/dev/git-friendly

Then add this directory to your PATH:

export PATH=~/dev/git-friendly:$PATH

Add the above to your ~/.bash_profile or ~/.bashrc so that it runs each time you launch a new terminal.

Usage

You now have some awesome new commands available: pull, push, branch, merge

Example session:

$ pull
$ branch awesomeness
$ echo "BUMP" >> README
$ git commit -a -m "Righteous bump"
$ branch master
$ merge awesomeness
$ push

Commands

pull Stash any local changes, pull from remote using rebase, updates submodules, pop your stash, then run `bundle install` and/or `npm install` 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 (works on Mac and Linux)
branch [name] Switch branches or create new local branch if it doesn’t exist. Intelligently sets up remote branch tracking so you can just type ‘git pull’ and not always ‘git pull origin newbranch’. If no argument specified will list all local and remote branches.
merge [name] Merge the specified branch into the current branch. Rebases first if the branch is local-only

Bonus: Pimp Your Configs

I strongly recommend editing your global ~/.gitconfig and adding chill features like ANSI color, command aliases (e.g. “git st” instead of “git status”), automatic remote tracking and more. Check out my ~/.gitconfig to get started.

I also recommend adding the current git branch to your Terminal prompt (PS1) or you’ll quickly lose your place — here is my pimp_prompt() bash function which goes in your ~/.bash_profile or ~/.bashrc, then type source ~/.bashrc to reload.

License

Code released under an MIT license.

Fork away, do whatever. Pull requests welcome!

Contributors

Something went wrong with that request. Please try again.