Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

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

Git sometimes requires typing two or three commands just to execute something basic like fetching new code. git-friendly adds a few new commands — pull, push, branch, merge and stash which:

  • does the most useful thing by default; plus
  • push copies a GitHub compare URL to your clipboard;
  • pull runs commands like bundle install, npm install, yarn install and composer install if necessary;
  • branch tracks remote branches if they are available;
  • stash includes untracked files by default.

Less time fighting Git — more time actually doing work.


Homebrew (macOS)

brew install git-friendly/git-friendly/git-friendly

The Homebrew tap for this project can be found here


Unofficial builds of stable releases can be found in Fedora Copr: fuhrmann/git-friendly.

dnf copr enable fuhrmann/git-friendly
dnf install git-friendly

Installer script (curl)

Run this one-liner, which will download the scripts into /usr/local/bin:

curl -sS | bash

Note: If you don’t have write access to /usr/local/bin you’ll need to run this using sudo.

You can change the installation directory:

curl -sS | bash -s ~/bin/git-friendly

Install from source

Checkout the code:

git clone git:// ~/dev/git-friendly

Then update your ~/.bash_profile or ~/.bashrc to make git-friendly available each time you launch a new terminal:

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


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

Example session:

branch awesomeness # Create a new branch (or switch to existing one)
echo "BUMP" >> README
git commit -a -m "Righteous bump"
branch main        # Switch back to main
merge awesomeness  # Merge awesomeness branch to main
push               # Push changes



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.

branch [name]

Supports branch deletion with -d or -D keys:

branch -d [name]
branch -D [name]

And switching to a previous branch with -:

branch -


  • Merge the specified branch into the current branch;
  • rebase first if the branch is local-only.
merge [name]


  • Stash any local changes;
  • pull from the remote using rebase;
  • update submodules;
  • pop your stash;
  • run bundle install, npm install, yarn install or composer install if there are any changes in Gemfile, package.json, etc.


Any extra arguments will be passed through to git push, for example push -f.


  • Stashes untracked files by default, when run without arguments;
  • behaves like normal git stash otherwise.
stash pop


Change git-friendly behavior using environment variables. For example, add this line to your ~/.bash_profile to disable running bundle install in the pull command:


Available environment variables:

Variable Description Commands Default value
GIT_FRIENDLY_NO_BUNDLE Disables bundle install pull false
GIT_FRIENDLY_NO_COMPOSER Disables composer install pull false
GIT_FRIENDLY_NO_NPM Disables npm install pull false
GIT_FRIENDLY_NO_YARN Disables yarn install pull false
GIT_FRIENDLY_NO_PNPM Disables pnpm install pull false
GIT_FRIENDLY_NO_COPY_URL_AFTER_PUSH Disables copying URL to clipboard push false

Supported package managers for 'pull'

  • bundler (ruby)
  • composer (PHP)
  • npm (JavaScript)
  • yarn (JavaScript)
  • pnpm (JavaScript)

Support for more is always welcome.

Bonus: Pimp Your Configs

We strongly recommend editing your global ~/.gitconfig and adding features like ANSI color, command aliases (like git st instead of git status), automatic remote tracking and more. Check out this sample ~/.gitconfig to get started.

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

Bonus: Shell Completion

Bash Shell Completion

Add to your shell config file .bash_profile, .bashrc or .profile:

if type __git_complete &> /dev/null; then
  _branch () {
    if [ "$delete" == "-d" ] || [ "$delete" == "-D" ]; then

  __git_complete branch _branch
  __git_complete merge _git_merge

Now typing branch <tab> will suggest or autocomplete branches you can checkout to, branch -d <tab> branches you can delete and merge <tab> branches you can merge.

Note: You need to call your git-completion script before the snippet.

Zsh Shell Completion

Add to your .zshrc:

fpath=($(brew --prefix)/share/zsh/functions $fpath)
autoload -Uz _git && _git
compdef __git_branch_names branch

Now you can type branch, press Tab and you’ll see a list of branches in your repo.

Note: You’ll need to adjust the path in the first line if you’re not using Homebrew or macOS.


MIT license.

Fork away, do whatever. Pull requests welcome.

Following the practices of Rubinius, anyone who submits an accepted patch is granted a commit bit (write access to the repository).

Following the practices of FAT Lab, anyone who submits an accepted patch is granted credit and attribution bits.


Jamie Wilkinson
Jamie Wilkinson

💻 📖
Artem Sapegin
Artem Sapegin

💻 📖
Maciej Małecki
Maciej Małecki

John Manoogian III
John Manoogian III

Rafael Corrêa Gomes
Rafael Corrêa Gomes

Harold Dennison
Harold Dennison

Ruan Carlos
Ruan Carlos

Ethan Bruning
Ethan Bruning

Ezekiel Templin
Ezekiel Templin


Ben Zörb
Ben Zörb

Pavel Prichodko
Pavel Prichodko

CJ Lazell
CJ Lazell

Philipp Trubchenko
Philipp Trubchenko