Create or clone a repo
git init
Creates a new repository in the current directory
git clone [url]
Clones a repository from the URL specified. Can be HTTPS or SSH. You can specify a folder name after the URL to customize it.
Add some files and commit them
git status
Shows the modified files, the current branch, the staged files.
git add [file]
Stages a file for next commit. File can be replaced by “.”, staging all modified files in the current directory and recursively.
git reset [file]
Unstages a file without altering the modifications.
git diff
Shows modifications made in unstaged files.
git diff --staged
Shows modifications made in staged files.
git commit -m [message]
Commit staged files with the message specified.
Using branches
git branch
Lists all local branches.
git branch [name]
Creates a branch with the specified name.
git switch [name]
git checkout [name]
Moves to the specified branch.
git log
Shows the commit history for the current branch.