Skip to content

Source Control

Zhao, Xuan edited this page Dec 5, 2020 · 7 revisions

How to use Source Control via GitHub for StudySafe

Cloning into your personal folder

Your personal folder is /home/<RCS ID>. Make sure you are in this folder by typing cd /home/<RCS ID> into the Terminal.

Once there, type git clone https://github.rpi.edu/DataINCITE/IDEA-COVID-StudySafe.git. This will clone the repository onto your personal folder.

Once done, enter the folder by typing cd IDEA-COVID-StudySafe. To see this visually, navigate to IDEA-COVID-StudySafe in your Files panel on RStudio.

How we make changes

We will not be committing to master, as this is bad practice. Instead, we will make a new branch for each new feature we would like to implement. This details how to do so.

Verify you're in the right folder by typing pwd into your Terminal. It should say /home/<RCS ID>/IDEA-COVID-StudySafe.

Verify what branches are available by typing git branch. The list of branches will print, and the branch you're on will be shown by an asterisk.

To create a new branch, type git branch <BRANCH NAME>, with <BRANCH NAME> being the name of the new branch.

Then, switch to the new branch by typing git checkout <BRANCH NAME>. To add this branch to the IDEA-COVID-StudySafe GitHub repository, type git push origin <BRANCH NAME>. RStudio will prompt you to put in your GitHub username and password, and may ask you to do a git-config command so that it knows who authors your future commits.

Verify on GitHub that the branch exists now.

Now, make your changes like you normally do. Once you're ready to commit to the online repository, do the following:

  1. git add -<FILE NAME>
  2. git commit -a -m "<COMMIT MESSAGE>", with being what your changes are about.
  3. git push origin <BRANCH NAME>.

Verify on GitHub that you see the commits on this branch.

How to push to master

Go on GitHub and make a pull request. This will not merge to master just yet, but it makes a request. You might have to resolve a merge conflict, but that's self explanatory. When someone on the Core App team reviews your pull request, s/he can accept it and the code will be merged to master.