Manages git repositories in Stata. It installs, updates, lists and removes git repositories containing Stata user-written programs. An alternative to sharing through ssc
or net
git must be installed and accessible from your command line.
- Create a directory called
git
in the same directory where your personal ado directory lives (i.e. make it a sibbling of your personalado
directory. - Clone this repo into the directory from step 1 (*nix/OSX commands shown here) :
cd my/personal/directory/git && git clone https://github.com/coderigo/stata-git stata-git
- Copy the
.ado
and.sthlp
files from the cloned repo from step 2 to your personal ado directory under theg
directory (create it if it does not exist). - Now you can keep the
git
command updated with this repo withgit update git
In Stata, type:
ssc install git
Note: keeping stata-git up to date with the changes in this GitHub repo is easier if you install it the manual way as updates to this repo are pretty much available instantly whereas ssc
updates can take up to a few days to get ticked through.
Install a program from repository (url or filepath)
git install https://github.com/coderigo/stata-switch
Uninstall program previously installed with git
git uninstall switch
Update program previously installed with git
git update switch
List all repositories managed by git
git list
A few handy tips to make it work best git
:
-
Use the snake-case format for your repository name and prefix it with "stata". For example, if your program is called helloWorld, your repository should be called stata-hello-world.
-
Use the camelCase format for your program name and any installable other auxiliary files including the .sthlp file.
-
Place all the files you want to be copied over in the root of your repository.
-
It works nicely (and it's easier for community collaboration) if you host your repository on a public repo like github.
Happy to take requests.
Please add to the tests.do
some sort of test, or run to make sure nothing's broken.
-
Have only tested this out on OSX, but feel it should work the same with *nix OSs. In theory should work on Windows, but have not tested it.
-
It requires repositories and program names to follow the
snake-case
andcamelCase
format respectively (there is no obvious way to read file data into a variable with Stata. Happy to be corrected)