Start

Initiate local repository:

git config --global user.name <First Last>
git config --global user.email <email@example.com>
git init                                          # Initialize a git repository

What we need most:

git add <file(s)>          # Add files/changes to git
git commit                 # Commit added files
git status                 # Repository info/status

What we need to connect Online-/Remote-Repositories

# Once to connect:
git remote add origin https://gitlab.example.com/<repository-owner-name>/<repository-name>.git
git push                   # Push new commits to remote (GitLab)
git pull                   # Pull new commits from remote (GitLab)

Get Information

Check repository status summary:

git status

Check history and old commits:

git log

Check differences:

git diff                   # for diff of uncommited changes
git diff <old_commit_hash> # for diff against old commit
git diff origin            # for diff remote repository

Check Differences:

Add files:

git add <file(s)>

Stage (optional alias for add):

git stage <file(s)>

See also: Git and GitLab Introduction, MOC Computing DevOps and Software