First Write script in python
Second Mark your Python file as executable
$ chmod +x mycmd.py
Third remove extension
$ mv mycmd.py mycmd
Finally Make sure your program is on the PATH
$ mkdir -p ~/bin
$ cp mygit ~/bin
export PATH=$PATH":$HOME/bin"
Add the this line to .profile or .bash_profile in your home directory:
export PATH=$PATH":$HOME/bin".
You can either use an editor to do it or run the following command to do that:
echo 'export PATH=$PATH":$HOME/bin"' >> .profile
For production release:
$ mycmd Hello, World!
/Users/youruser/bin/mygit
Hello,
World!