Welcome! Before contributing to lab repositories, please complete this short Git & GitHub tutorial.
The most important goal is to learn how to keep your work safely backed up using GitHub.
A good habit is to commit and push your code at the end of every work day.
By the end of this tutorial, you will know how to:
- Create a GitHub account
- Clone a repository
- Edit files in a repository
- Commit changes
- Push changes to GitHub
Later you will typically create your own repository for your projects and use GitHub as a backup and version history.
Most students use Mac + PyCharm, but we start with the command line workflow because it works everywhere.
Git is a version control system. It tracks changes to files over time and allows you to return to earlier versions of your code.
Key ideas:
- A repository stores a project and its history.
- A commit records a snapshot of your changes.
- You can always go back to previous commits.
GitHub is a website that hosts Git repositories online.
This allows you to:
- back up your code
- work across multiple computers
- collaborate with others
- Go to https://github.com
- Create an account using your academic email
- Send your GitHub username to the lab admin (currently Roey) so you can be added to the organization
Before continuing, complete the official GitHub beginner tutorial:
https://docs.github.com/en/get-started/start-your-journey/hello-world
This tutorial introduces:
- repositories
- commits
- branches
- pull requests
Once you finish it, return here to continue.
Many commands in this tutorial are run in a terminal (also called a command line).
Mac
Press Command + Space, type Terminal, and press Enter.
Alternatively:
Finder → Applications → Utilities → Terminal
Windows
You can use Command Prompt or PowerShell.
Option 1 — Command Prompt
- Click the Start Menu
- Type cmd
- Open Command Prompt
Option 2 — PowerShell
- Click the Start Menu
- Type PowerShell
- Open Windows PowerShell
After installing Git, you may also use Git Bash.
On some lab computers Git may already be installed.
Run:
git --versionIf you see something like:
git version 2.x.x
Git is already installed.
If not, install it in the next step.
Mac
Run:
git --versionmacOS will prompt you to install Command Line Tools.
Run:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"Make sure the email matches your GitHub account.
Choose where you want to store your projects.
Navigate there:
cd path/to/your/projectsClone the repository:
git clone https://github.com/schurr-lab/git-tutorial.git
cd git-tutorialGit may open a GitHub login window in your browser.
Choose:
Sign in with your browser
If you use two-factor authentication, enter the code from your authenticator app.
If a page asks you to authorize the Git Ecosystem, click it and confirm.
You should see:
git-tutorial/
├── README.md
├── students.md
└── practice/
Enter the repository:
cd git-tutorialOpen the file:
students.md
You can use any text editor, for example:
- PyCharm
- VS Code
- Notepad
- TextEdit
Add your name:
- Alice Smith – PhD Student – 2026Save the file.
Inside the practice/ folder create a file:
yourname.txt
Example:
alice-smith.txt
Write:
Hello GitHub!
This is my first Git commit.
Save the file.
git add students.md practice/yourname.txt
git commit -m "Add Alice Smith to students list and practice file"A commit records your changes.
git pushThis uploads your changes to GitHub.
Now your work is safely stored online.
When working on your own projects:
- Edit your files
- Save them
- Commit your work
git add .
git commit -m "Describe what you did"
git push
Doing this at the end of every day ensures your code is always backed up.
If you prefer PyCharm:
https://www.jetbrains.com/help/pycharm/set-up-a-git-repository.html
Typical workflow:
- Clone repository
File → Get from VCS
-
Edit files
-
Commit
Use the Commit tab.
- Push
Click Push.
These features are important when collaborating on shared repositories.
Branches allow you to work on changes without affecting the main project.
Example:
git checkout -b new-feature
A Pull Request asks maintainers to review and merge your changes.
This is commonly used when multiple researchers collaborate on the same codebase.
Git tutorial
https://git-scm.com/docs/gittutorial
GitHub documentation
https://docs.github.com
Markdown guide
https://www.markdownguide.org/basic-syntax/
Lab administrators review and maintain this repository.
If you encounter problems, open a GitHub issue or ask a lab member.