Summary and Schedule
This is a new lesson built with The Carpentries Workbench.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Introduction to Git |
What is Git? What problem does it solve? |
Duration: 00h 21m | 2. Why use Git? | Why use version control? |
Duration: 00h 41m | 3. Fundamental concepts | What are the fundamental concepts of version control? |
Duration: 01h 01m | 4. Your first Git repository |
How do we create a Git repository? What are some of the basic Git commands? |
Duration: 01h 22m | 5. Tracking changes |
How do we create a Git repository? What are some of the basic Git commands? |
Duration: 01h 42m | 6. Remotes: pushing and pulling |
How do we interact with Git remotes? What does pushing and pulling mean? |
Duration: 02h 02m | 7. Cloning a repository |
How do we collaborate with Git? How do we get code from GitHub into our computer? How do we revert changes that we do not want? |
Duration: 02h 24m | 8. Forking a repository |
What does forking a repository mean? What is a merge conflict? |
Duration: 02h 47m | 9. Tips and best practices |
How do we incorporate Git into our everyday work? What are some tips and best practices for working with Git? |
Duration: 03h 07m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
This lesson will teach you how to manage software projects with the popular version control system Git.
The example project will assume a basic understanding of either Python or R, and learners are expected to be comfortable using simple commands in a Bash shell.
The lesson assumes learners are working with a Linux style shell (i.e. zsh on MacOS or GitBash on Windows) inside the VS Code IDE.
It is important that students complete these setup tasks before the workshop.
Environment Management with Conda
Details
In this workshop we will use conda
to manage Python
environments and install packages.
Our preferred flavour of conda
is provided by
Miniforge3, but you could also use Miniconda
.
After installing miniforge you will use conda
from
within the GitBash
shell to manage environments and
software instalation. See “Installing Git” below.
- Install the latest version of Miniforge3
- Open the
miniforge prompt
app and run the commandconda init bash
- Install the latest version of Miniforge3
Note: Select the “x86_64” for Intel processors, or “Arm64” for Apple Silicon chips.
Check installation:
- Open the
Terminal
app. - Check for
(base)
prefix in your prompt. - Run
conda --version
Installing Git
Windows users will need to install GitBash
which is a
linux-like terminal that comes pre-installed with Git
.
You will use conda
from within the GitBash
shell to manage environments and software instalation.
- Install GitBash
Windows checks:
- Open the
GitBash
terminal app. - Check for
(base)
prefix in your prompt. - If
(base)
is not present, open the “miniforge prompt” app and runconda init bash
- Open a new
GitBash
terminal session. - Run
conda --version
- Run
git --version
Open the Terminal app and run git --version
. You may be
prompted to install git.
Note: You may be prompted to install Xcode which will take some time.
Configure Git
If you are setting up Git for the first time, you will need to set your user name and email.
IMPORTANT:
- You must use same email as your github account.
- You should use an email address that you will always have access to (not a work or university address).
BASH
git config --global user.name "Alfredo Linguini"
git config --global user.email "a.linguini@gmail.com"
Please use your own name and email address instead of Alfredo’s. And make sure you use the same email associated with your GitHub account.
We will also set the default editor as nano
.
Setup Github
Create a GitHub account
Create a new account at GitHub.com if you do not have one.
Again, use an email address that you will always have access to (not a work or university address).
Configure SSH access
If you do not have ssh set up for git create a new ssh key and add the key to your github account.
Note: On windows you should do this from the GitBash shell.
To confirm that your key is correctly configured run:
VS Code setup
VS Code is a popular Interactive Development Environment (IDE) that we will use to edit our project.
Follow the VS Code installation instructions here.
If you are on Windows, also follow the steps below:
- Open VS Code and set GitBash as default terminal.
- From the
View
menu selectCommand Palette --> Terminal: Select Default Profile
. - Then select
GitBash
as the default profile.