Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Utility scripts for use with the Git version control system
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Some scripts to use with Git that I use that might be handy for others. Please understand what they do before using them and use them at your own risk.

(original post about


cd ~
git clone

Then add the following to your .bash_profile, or whatever you want:

if [ -f ~/git-scripts/ ]; then
  source ~/git-scripts/

Restart or whatever, and then test by doing:



Read each script and understand what it does.


The following tracks a remote branch if it already exists, or makes a remotely tracking git branch if one doesn't exist, or just switches to the local branch by that name:

gbranch (branch_name)

The following tracks a remote branch if it already exists, or branches from the specified remote branch to make a remotely tracking git branch from it if the (new) branch_name doesn't exist, or just switches to the local (new) branch_name by that name:

gbranch (some_branch_name) (existing_remote_branch_to_branch_from)


The following removes either local, remote, or both local and remote branches with the specified name:

gdelete (branch_name)

It used to be a quiet delete of both, but that may result in an accidentally deletion. It now prompts whether you want to delete local, remote, or both, and if you respond with something other than that, it won't delete.


gpull and gpush make it easier to push/pull to the current branch, provided by Cody Caughlan in reply to this stackoverflow thread:


gmf is just an alias to generate a merge commit even if the merge resolved as a fast-forward (someone on our team came up with this alias, and even though it isn't clear, it is short and I remember it):

gmf (branch_name_to_merge_into_current_branch)


If you get the latest, be sure to either source ~/git-scripts/ or close/reopen all terminal sessions.


Copyright (c) 2010 Gary S. Weaver, released under the MIT license.

Something went wrong with that request. Please try again.