Source Control
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:
- Type git add -A
- Type git commit -m "", with being what your changes are about.
- 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.