Skip to content

Source Control

Van Hal, Christina edited this page Dec 16, 2020 · 6 revisions

How to use Source Control via GitHub for SafeCampus

Cloning into your personal folder

Your personal folder is /home/. Make sure you are in this folder by typing cd /home/YourFolder into the Terminal.

Once there, type git clone [link to the repository you want to clone]. This will clone the repository onto your personal folder.

Once done, enter the folder by typing cd [Folder]. To see this visually, navigate to SafeCampus 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/YourOriginalFolder/YourFolder.

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 SafeCampus 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 [insert file path]
  2. Type git commit -m "", with the message in quotes being what your changes are about.
  3. Type git push, and put in your username and password if it prompts you to do so.
  4. Verify on GitHub that you see the commits on this branch.

Note that you'll need to add each individual file you changed. This ensures you do not edit over other people's files as it sometimes happens of you add all files.

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.

Note: This text was take from the section on the MM Github Wiki by Taras Kaminsky and edited.