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.
cd ~ git clone http://github.com/garysweaver/git-scripts.git
Then add the following to your .bash_profile, or whatever you want:
if [ -f ~/git-scripts/git-scripts.sh ]; then source ~/git-scripts/git-scripts.sh fi
Restart Terminal.app 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:
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:
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):
If you get the latest, be sure to either
source ~/git-scripts/git-scripts.sh or close/reopen all terminal sessions.
Copyright (c) 2010 Gary S. Weaver, released under the MIT license.