[this article has not been reviewed/checked since March 2021]
About the Linux git Command by Bonnie Kwong
A repository is simply a collection of files. Each time you "cd" into the "jacktrip" directory from your device, you're navigating to your local copy of the JackTrip files, so you don't have to pull. It's just like bunch of text files. For instance, if you "cd" into the ~/Downloads directory of your Mac and use the "ls" command to list all files, you'll see files of any type you've downloaded to your computer: installers, pdf, word docs, etc. You can have multiple copies of the JackTrip repo on your local file system as long as their names do not conflict in the same directory, just like text files.
You only need to clone a project when you're starting from zero, when you don't have the JackTrip repo on a particular device and you need to access the central repository on Github to download the project. A remote repository is one that's not on your device. Multiple versions of JackTrip exist on Github too. But for our purposes, we'll focus on the central repository, where engineers eventually "push" their code if they want their changes to make it to the official version of JackTrip. When you have a device and you want to build JackTrip from source for the first time, whether it's on your RPi or a computer, you always need to get the code from the central repository on Github.
git clone https://github.com/jacktrip/jacktrip.git
The url in this step is the central JackTrip repository. After the initial "cloning" of the project, git on your machine will recognize https://github.com/jacktrip/jacktrip.git as the remote called "origin" because this is where your local copy originated from. Now that you have a copy of the project, whenever you want the changes the engineers have made, e.g. a new version, you need to pull. Note: you're pulling the incremental changes, not the entire repository--the key difference between cloning and pulling. The "git pull" command is always for bringing content from a remote repository and immediately updating the local repository to match it. If you simply access want to access your local JackTrip repo as is, you would "cd" into it.
The only change you need to make is to replace "git pull main" with "git pull origin main." To answer your question, in the context of your instructions, "git pull" and "git pull origin main" are essentially the same because "origin main" is implied in the "git pull" command--you're telling git to pull from the remote repo you originally cloned your copy from, and from the "main" branch, which is the branch you should already be on. By including "git checkout main" in your instructions, you're making sure people are on the right branch. Looks good.
There are other remotes and branches you can choose to pull from. For instance, Chris Chafe has a fork of the project (https://github.com/cchafe/jacktrip/branches). You could decide to add his remote to your JackTrip repo and nickname it "chris" instead of "origin" in your copy of git. Within his remote, there are many branches, e.g. main-faust-hubpatch. If you decided for some reason you want your main branch to pull from the main-faust-hubpatch branch of his repo, you could do something like git pull chris main-faust-hubpatch, once you set everything up. I won't go into the details you don't really want to do this. Just to give you a more concrete examples--that's all.
Switch Between Versions of Jacktrip on your RPi 4B and/or Update to Latest Released Version of Jacktrip
In this example, there are two branches on your RPi 4B, main and anotherone.
Note that the same steps apply if you already have a version of jacktrip on your RPi 4B and you want to update jacktrip to the latest released version of jacktrip.
1. Open new Terminal window
2. See where you are - you should be at /home/pi
3. Change to subdirectory jacktrip:
4. Check what branches you have:
5a. Select the branch you want (if you want to set the branch to anotherone or a different branch, substitute the name of the branch you want for main in this step):
git checkout main
5b. If you just want to switch branches locally on your RPi (as in cases where you want to restore an older version of jacktrip that you already have on your RPi), skip on to Step 6. Otherwise, to update the branch that you just selected in Step 5a. to include any developer changes made to that version (if you substituted anotherone or a different branch in Step 5a. for main, do likewise in this step), type:
git pull origin main
6. Build the version of jacktrip you selected in Step 5a. on your RPi:
7. After it finishes building:
8. Check that you have the correct version of jacktrip:
[online documentation about git-checkout - Switch branches or restore working tree files: https://git-scm.com/docs/git-checkout]