Getting Started With Git
Creating a repository
Git is distrubited, that means that every user has a complete copy of the history of a given repository. This means you don't need to use a git host such as gitlab or github if you don't want to. It's probably still a good idea incase your computer gets damaged or you accedently delete your repository.
git init .
Commits
Commits are the basic blocks of your git repo, they represent a change. You should try to keep your commit a logical unit of work which represents doing 1 thing. This makes it easier to figure out what has been done by looking over your commit history in the future. It also makes it easier to cherry pick commits and revert changes.
Creating a commit
Stage all the files you have changed using git add
git add .
git commit -m "my commit message"
Fixing a commit
Don't do this once you have pushed your commit, it could cause problems for other users!
git commit --amend
Branches
Creating a new branch
git checkout -b new_branch_name
Basing a branch of master
git checkout name_on_master