Week 1: GitHub and repo orientation

2026-04-07

Git is an open-source version control system which tracks changes to local files. It was originally developed by Linus Torvalds, the creator of the Linux operating system kernel.

Check version

git --version

Configure Git

The username and email

git config --global user.name "Josef K"
git config --global user.email josef.k@mail.com

You can check your configuration settings with:

git config --list --global

Create a folder

mkdir Projects/uneca
cd Projects/uneca

Initialise a Git repository

git init

A hidden folder called .git is created in the directory which stores the history of the repository

Check state of repo

List which files are staged, unstaged, and untracked.

git status

Add a file

Add file(s) to staging area

echo Algeria >> members.md
git add members.md
git status

Commit changes

Take a snapshot of the state of the repo

git commit -m "Collating list of member states"

Modify file

echo Angola >> members.md
git diff

git status

Check commit history

git log

Commit early and commit often

Ignoring files

A .gitignore is a text file that lists all of the files and folders that you don’t want tracked by Git. For example, this list could include datasets that contain sensitive data.

echo *.csv >> .gitignore

GitHub hosts Git repositories online.

Create a new remote repository

Connect local to remote repository

Make the GitHub repository a remote for the local repository

git remote add origin https://github.com/rcatlord/uneca.git

Verify remote

git remote -v

Push local changes to a remote

git push -u origin main

README

A README provides information about the purpose and contents of a GitHub repo. Each README file is written using Markdown, a simple formatting syntax for plain text documents that can be easily converted into HTML.

Branches

If you are collaborating with others it is generally a good idea to create what’s called a branch. This is essentially a sandbox for testing out code. The working code is on the main branch but the experimental code is held on a separate, isolated branch.

These are the steps that you might follow:

  1. Create a branch: git branch dev
  2. Switch to the dev branch: git checkout dev
  3. Push changes to the remote branch: git push -u origin dev

Typical workflow

git clone
git checkout -b dev
git add
git commit -m "Initial commit"
git push -u origin dev
# Open a Pull Request and Merge
git switch main
git pull
git branch -d dev
git push --delete origin dev

Demo