Go to https://try.github.io/ and look for the "Learn by reading" and "Learn by doing" sections.
Browse the "Pro Git book" at https://git-scm.com/book.
Make sure you are familiar with the following terms:
- working tree = workspace known to git
- staging area = stage = index
- local vs. remote (upstream) repository
- tracked/untracked file
- commit vs. revision
Make yourself familiar with git reflog,
see here for a short introduction.
Make yourself familiar with interactive rebasing.
Some useful revisions to know:
HEAD: references the current commitORIG_HEADvs.HEAD@{1}: See https://stackoverflow.com/a/967611/704821- naked
@: same asHEAD @^and@~: references the parent of the current commit@^2: references the second parent of the current commit (for merge commits)@~2: references the 2nd generation parent of the current commit, i.e. the parent of the parent@^^^and@~~~and@~3are equivalent@{FOO}whenFOOis not a number: same asHEAD@{foo}@{u}: the current upstream, e.g.origin/main
Hint: You can de-reference a revision with git rev-parse REVISION.
Some useful cheat sheets:
- github.com » Git Cheat Sheets
- devhints.io »
1 Learning | 2 Best practices »