Last Updated: 03/09/2012 05:22:00 PM
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:
- Create a file called git-updatedemo
- It is must start with git-
- 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.
Comments
- Tripp Lilley
-
Take a look at git-sh-setup for a handy utility for building git extensions in bash/sh:
http://www.kernel.org/pub/software/scm/git/docs/git-sh-setup.html
(or man git-sh-setup)
You set a few environment variables it uses for usage message, etc., and it gives you back environment vars and utility functions for some git basics.
- August 14, 2012, 1:39 PM