Wojciech Hardy
Click here to view the course repository on GitHub
This is the course repository. It contains the base course materials and will be updated before some of the classes.
The idea is:
First you need to fork the course repository. Forking is a GitHub thing (not a Git thing!). It creates a copy of a repository on GitHub.
Importantly: one can access a list of the forked repositories. So when you work with your copies, I'll be able to browse through your copied repositories and check your commits.
Click the "Fork" button to proceed. (It's grayed out in the picture below because I can't fork my own repository).
Note: you cannot fork a repository more than once.
2nd thing you need is to clone your repository. This will allow you to implement changes. IMPORTANT: you need to clone your copy of the course repository, not the original one!
Click the green "Code" button in the repository page (see below) and copy the HTTPS URL. Not sure if you're copying the right URL? By default it should include your username and look like this: https://github.com/USERNAME/RRcourse2024.git
Go down to see what options you have now.
Pick a suitable location and run:
git clone <copied_url>
It should create a RRcourse2024 folder with the repository inside. Warning: avoid creating repositories within repositories! Git doesn't like it!
Alternatively, you can use
git clone <copied_url> newName
to pick a new name for your local cloned repository.
First, download and install GitHub Desktop.
Second, launch and log in using your GitHub account name and password.
Third, File -> Clone repository…
Choose your copy of the course repo, select a path at your desktop.
Done.
First, download and install R (unless you already have it).
Second, download and install RStudio (unless you already have it).
Third, launch RStudio, then File -> New Project… -> Version Control -> Git
Fourth, paste the repository URL, pick a location for your repository/project. Create.
Great! you can now work in your local repository and push your commits back to YOUR copy of the course repository, that you have on GitHub.
If it's the first time you did this, you might be asked for authentication when pushing. Remember, it might not really ask for your GitHub password - it might want your Personal Access Token.
But what if we want to grab something from the original course repository (owned by WHardyUW on GitHub)?
Right now, your local repository has a direct connection to your copy of the course repo. Not the original course repo.
If you want to grab updates from the original course repo (let's call it WHardyUW/RRcourse2024), you need to tell Git where to look for this additional 'remote' repository. You do it like so:
git remote add <some-name> https://github.com/WHardyUW/RRcourse2024.git
Note: <some-name> is just a name that you provide to your new link (like 'originalRepo' or 'WHardyRepo', etc.) So you can refer to the whole link without having to repeat it. Note that we're providing the link to the original repository, owned by WHardyUW. You already have a link to your own. This is a new one.
Let's start by checking for new information at WHardyUW/RRcourse2024:
git fetch <some-name>
where some-name
is the name you chose before.
Execute a merge:
git merge <some-name>/main
Note that some-name
isn't a repository name. It's the name of the link.