Table of Contents

Git (Examples)

Basics

Creating a repository with an initial commit:

git init

Adding a file to the staging area:

git add file.txt

Un-adding a file from the staging area:

git restore --staged file.txt

Showing what's in the staging area:

git status

Creating a commit:

git commit -m 'add: feature'

Stashing

Stashing changes in the staging area:

git stash

Restoring stashed changes:

git stash pop

Giving up on stashed changes (dropping them):

git stash drop