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/. Make sure you are in this folder by typing "cd /home/" 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//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 ", with being the name of the new branch.

Then, switch to the new branch by typing "git checkout ". To add this branch to the IDEA-COVID-StudySafe GitHub repository, type "git push origin ". 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. Type git add -A
  2. Type git commit -m "", with being what your changes are about.
  3. Type git push, and put in your username and password if it prompts you to do so. Verify on GitHub that you see the commits on this branch.