Essential git cheat sheet for loners

Posted on Wed 22 January 2025 in git • Tagged with git

This are the basic commands to operate with git as a loner: no branches, no remotes, no merges... Just the basic stuff.

The minimum concepts you need to know are:

  • Git is a version control system. It allows you to store changes in your files. Don't mix it with GitHub, which is a platform to store your repositories.
  • Working directory: the directory where you are working.
  • Staging area: a place to store changes before committing them.
  • Repository: the place where the changes are stored.
  • Commit: a set of changes stored in the repository. They are identified by a hash. For example, commit 1234567.

The basic workflow is:

  1. Make changes in the working directory.
  2. Add changes to the staging area.
  3. Commit changes to the repository.
  4. Repeat.

Conceptually: working directory -> staging area -> repository.

Configuration

git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

Create a new repository

In the directory of your project:

git init

Add files to the repository

This adds all the changes in your current directory to the …


Continue reading