Pimp your git workflow. Just type pull, branch, merge, push
Shell
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 98 commits behind jamiew:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.textile
branch
install.sh
merge
pull
push

README.textile

Intro

git-friendly is a collection of shell scripts for automating common git workflows. The goal is to make pulling, branching, and merging fast and painless.

Git is super powerful but often requires typing 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 underlying git commands + 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

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://github.com/jamiew/git-friendly/raw/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://github.com/jamiew/git-friendly/raw/master/install.sh /usr/bin)

Advanced Install

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:

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

Approximate workflow:

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

Commands

Primary

pull Stash any local changes, pull from remote using rebase, updates submodules, pops your stash, then runs `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 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 into the current branch. 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 aliases like “git st” instead of “git status”, automatic remote tracking & more. Check out my ~/.gitconfig

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

Contributors

License

Code released under an MIT license.

Fork away, do whatever. Pull requests welcome!