It can be difficult to code in the terminal of your computer. We therefore suggest downloading an Integrated Developer Environment (IDE) such as Wing IDE, Pycharm, Visual Studio for you to code in. Finally, you may have to link the path of your MARC download (i.e. “file_path_to_marc/MARC/trunk” ) to your IDE.
GitHub is essentially “Google Drive” for coders. It allows groups of people to collaborate, share code, store projects, and track progress. Here is a nice short video of the basics of GitHub. We have also provided a list of some of the most frequently used git commands below. Note that this is not an exhaustive list of commands.
A highly recommended alternative to pushing local changes to the cloud or pulling the most recent version of your code from the cloud via the terminal is to use GitHub Desktop, an interface that handles all the backend for you, allowing you to focus on coding!
Cloning a repository from GitHub
On your computer navigate to where you want to put the MARC repo. Open a terminal and run the following command: git clone https://github.com/mitleads/MARC.git
Checking the status of files
git status
Adding Untracked Files
git add <path of file from git repo base>
This adds one file that is untracked
if you type git status again it will display the new file as changes to commit
You can use this command to stage files that have been modified but are already tracked
To add all new files that are either untracked or modified
git add .
If you run git status and see a list of modified files as a list of untracked files, you want to add the untracked file to the modified files before you run git commit. run the following commands:
git add -u
git add <filename> (note that the file name starts off with the trunk folder i.e. first folder in
The repository. once you run git status again you will see the list of modified files, as well as a list of new files you, are now able to run git commit -m 'commit notes'
To pull all new branches
git fetch
Often, you’ll have a class of files that you don’t want Git to automatically add or even show you as being untracked. These are generally automatically generated files such as log files or files produced by your build system. In such cases, you can create a file listing patterns to match the name
git ignore
If the git status command is too vague for you — you want to know exactly what you changed, not just which files were changed — you can use the git diff command. We’ll cover git diff in more detail later; but you’ll probably use it most often to answer these two questions: What have you changed but not yet staged? And what have you staged that you are about to commit? Although git status answers those questions very generally, git diff shows you the exact lines added and removed — the patch, as it were.
git diff
If you want to see what you’ve staged that will go into your next commit, you can use git diff --cached. This command compares your staged changes to your last commit:
git diff --cached
Now that your staging area is set up the way you want it, you can commit your changes. Remember that anything that is still unstaged — any files you have created or modified that you haven’t run git add on since you edited them — won’t go into this commit.
git commit - m “<enter what the commit is about>”
Push commits to the branch you are working on
git push
Pulls changes from the develop branch into the local branch (branch currently working on)
git pull <branch name>
To temporarily stash changes that you do not want to include in a commit
git stash
Undo all changes on your local machine to the previous commit
git reset --HARD
Checking out a file from a branch to overwrite the version of on our local machine.If you want to check out an earlier version of a file (that you committed and pushed) from the same branch you are working on simply use git checkout <filename>
git checkout <origin branch> <filename> (don/t include <>)
You can also choose which one you want to use either "ours" or "theirs". typically you want "ours" since the most recent one will be on the server
git checkout --ours <path/to/conflict-file.css> (don/t include <>)