Making your first commit
Great, now we have Git set up! You might have some questions about the Git Setup process:
Adding files to a snapshot
By default, Git does not know what files it should be including in a snapshot (and this is a good thing because we don't want Git to just add every file as they may contain sensitive information).
This is where the "three areas" concept comes into play. It is often good to think of your projects with Git as three separate concepts:

Working directory: where your codebase actually resides
Staging area: set of files that you want to include in a snapshot
Repository: local/remote repository storing metadata about the project and Git
By default, all of your files reside in the working directory and are not yet added to the staging area. If you want a file included in the staging area, then you must first add it to the staging area (we will cover how this happens later on).

The traditional way is to use the commands in Command Glossary to add files to the staged area, then using git commit
. Let's try using lazygit to speed up this workflow.
To start, let's first initialize a repository somewhere.
mkdir recipe_repo
cd recipe_repo
git init
Make a new file, recipe.txt
and modifying it a little.
Now, run lazygit
lazygit
Hit 2 to go to the files submenu.
Hit a to stage all commits (this is the same as
git commit -A
)Hit spacebar to stage commits by individual files
Hit Enter to enter into a file and use spacebar to select line by line which files to stage (This is known as interactive staging)
Once you've selected what you want to commit, press c, and enter a message, then hit Enter to commit
Ignoring files
See: Ignoring Files
Last updated