Git is very complicated, in total. You can do... anything.
If you use a subset of Git, it can be quite simple and very useful.
So let's try to keep it simple today.
git init starts
git status shows what's new/changed
git add adds files
git rm removes them
(or you can
git add .)
git commit -m "Saved!"
Introduction to some terms, with some basic starter steps
Secret stuff lives in
Everything else is your "work tree", your normal files
What changes are pending? Sometimes called index, but "staging" is clearer
git add .
If you do
git status and see nothing, you are
Changed files, new files, deleted files... those all create a dirty tree.
HEAD (of current branch, usually
puts changes from your working directory into the stage
puts original copy from HEAD and overwrites your working copy
red lines are in working directory only
green lines are in stage
puts stuff from stage into HEAD
git commit -m "A helpful message!"
Now let's clone an example repository:
(don't put git repos inside other git repos)
git clone https://github.com/uwmadison-chm/bioread
Different versions, simultaneously
Git stores a directed acyclic graph (DAG)
git checkout -b newbranch
Naming a particular version, "v1.0.0"
git tag v2.2.0
Every version (state) of the tree has a generated name
git log --oneline
git diff b4a2
git diff v2.1.0
git diff v2.0.0..v2.1.0
A remote is a copy of the repo that we can push and pull changes to and from
fetch from some central place, then
rebase your work on it)
push to somewhere
(often Github or similar host)
git branch -m master main
git log -S
rebase -i: interactively rewriting history!