Last Updated: 03/09/2012 05:22:00 PM

Create your own custom git command!

Create your own custom git command!

This may be old hat for some of you but I stumbled on this today, while looking around in the Git folder.  On my windows machine, I opened C:\Program Files\Git\libexec\git-core  Some of the files are .exe files others have no file extension. I opened git-pull in notepad++  You may notice it is actually written in shell.  Yup. Pull is just a shell script that simplifies using the git plumbing.  Apparently you can write git command in just about any language.

So for instance, we have server for demo purposes.  All it ever does it pull down code from our private bitbucket repository. I can save keystrokes by creating a custom git command:


  1. Create a file called git-updatedemo
    1. It is must start with git-
    2. don't let it have any file extension

Below is an example of what I did, you can play around with comands that fit your situation.


# git-updatedemo
# Tim Cunningham
#git checkout origin/DEV  this checks out the remote
cd /f/domains/pts55
git remote add origin
git pull --rebase origin DEV 
git checkout DEV
git status
Save that file to C:\Program Files\Git\libexec\git-core (on Windows)
now start git bash type:
git updatedemo
your new command should work!