-
Notifications
You must be signed in to change notification settings - Fork 2
2. Git & GitHub
Yaniv Carmel edited this page Apr 3, 2022
·
21 revisions
In this section, you'll install git, a software for version control (managing changes in software code). Then, you'll create a repository in GitHub, a git-based platform to store your project.
- Download & install git.
- Create a github.com user.
- As a student, you are entitled to GitHub pro. Go to your user's settings, upload the required documents and get it :)
- When collaborating, one member of the pair should create a new repository, named, for example,
matam-hw1. - That person should invite their partner to collaborate, by going to the repository's settings -> collaborators -> add people.
The next few steps are optional (but recommended!). They require GitHub pro (see step 3). We are going to prohibit making changes directly to your project's main branch, which is a bad practice that could lead to mistake.
- go to settings -> branches -> branch protection rules -> "add rule" -> "require a pull request before merging".
- Tick "Include administrators", too.
- Consider ticking off "Require approvals" - this would require both partners to approve each change to the project (we recommend keeping it ticked).
- Under "branch name pattern", put "main", and create the new rule.
Let's make our first contribution to the project. For now, we'll work directly from the GitHub website. We'll add a .gitignore file. This file allows us to specify what files within our project directory should be ignored (not uploaded to GitHub).
- Download and upload it to your repository (you can simply drag-and-drop it). In git terminology, this is a commit (a change to some version of the project). You'll need to tick "Create a new branch for this commit and start a pull request"
- You will be immediately redirected to a new page, in which you'll make a git pull request (a request to merge your change into another branch). Click "Create pull request".
- Have your partner review the pull request. If they approve it, they should click "Merge pull request", and then they can safely click "Delete branch".