Diagram

Commands
- Initial configuration:
Init
- Initialize repository:
1git init && git commit --allow-empty -m 'Initial commit' - Clone repository:
1git clone "$url" ["$dir"]
Working tree and index (staging area)
- :bar_chart: Show the working tree status:
1git status - :heavy_plus_sign: Stage changes in a file to the index:
1git add "$filename" - Show unstaged changes (diff between the working tree and the index):
1git diff - Show staged changes in the index (diff between the index and the
HEAD):1git diff --cached - :heavy_minus_sign: Unstage a file, keep changes in the working directory:
1git reset "$filename" - Clear the index, update the working tree from the specified commit:
1git reset --hard "$commit"
Branches
- :scroll: List local branches:
1git branch - List all branches (with remote ones):
1git branch -av - :green_circle: Create a new branch from the current commit (
HEAD):1git checkout -b "$branch"1git branch "$branch" && git switch "$branch"1git switch -c "$branch" - :arrow_right_hook: Switch to a branch (update working tree and index):
1git checkout "$branch"1git switch "$branch" - Merge the specified branch into the current one:
1git merge "$branch" - Apply commits of current branch ahead of the specified one:
1git rebase "$branch" - Rename branch:
1git branch -m "$new_branch" - :red_circle: Delete branch:
1git branch -d "$branch"