To view the STATA DO and html files, you can pull from the repository following instructions below. Alternatively, can click on Clone or Download and click Download Zip, which will download all files in Stata4Econ repository. Additionally, if you open one of the HTML files on github.com and would like to view it directly, append this to the beginning of the current HTML page's full URL: http://htmlpreview.github.io/? (see https://github.com/htmlpreview/htmlpreview.github.com for more information on how)
You can set up your own github account if you would like. That is however not necessary for completing the following steps. Github allows us to host and share codes in the form of git repositories. git is a type of repository.
- Download Git from here. Install the git program, follow on-screen instructions
- Search for the git bash program on your computer, open it. A window with black background opens up
- Type in: cd ~/, press enter, this takes your to the user directory on your computer. Type in: pwd, press enter, this shows you the path to your user directory, for me, it is for example:
/c/Users/fan
This is for first time set-up. We clone a repository from github to your local drive.
- Create a directory under your user main for git repositories (only have to do this once)
mkdir ~/GitRepos
- Enter into the directory, it is just a folder on your computer
cd ~/GitRepos
- Clone our repository inside GitRepos. Note that this is just downloading a folder to your computer, but rather than clicking on web page, we are downloading via command-line.
git clone https://github.com/FanWangEcon/Stata4Econ
- Now you can go to your folder and see our latest files. And you can open up matlab and set the directory to the one that contains Stata4Econ. For me that would be this folder, this is a git folder:
/c/Users/fan/GitRepos/Stata4Econ
I will be updating the files in our shared repository. You can pull from the shared repository to get the latest files.
The instructions below will eliminate any local changes you have made to the files and replace them with latest from our github repository. If you want to save your local changes, re-save the files that you have modified in another folder for yourself before you proceed with the codes below.
- Go to our Stata4Econ folder:
cd ~/GitRepos/Stata4Econ
- First fetch all changes from origin (which we defined previously)
git fetch origin
- Reset your local repository
git reset --hard origin/master
- Pull from remote replace local
git pull origin master