Skip to content
Git
Basics

Basics

Creating a repo

In the directory of your project: git init will create the repo.

Adding files to the stage

The “stage” is a set of files which are included in the repo - the changes made to these files are monitored and saved.

To stage (add to the stage) all files in a directory and subdirectory: git add . - do this at the beginning after initialising the repo.

To stage a single file git add path/to/file.ext

View unstaged files

Before a file is staged using git add: git diff

Git commits

Warning: only staged files are included in a commit - add them first using git add [file]

At the very beginning: git commit -m "Initial commit - project start"

Then after every “chapter” of your work: git commit -m "Briefly - what has changed"

To check the changes you have made since the last commit: git status

Git log

This shows you the log of your commits: git log