Essential git cheat sheet for loners
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:
- Make changes in the working directory.
- Add changes to the staging area.
- Commit changes to the repository.
- 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