git

References

Summary

git add
git stage
git commit -m "Message"
git remote -verify
git push -upstream origin main  

touch .gitignore
vi .gitignore  

Terminology

Repo / Repository: a project

Commit: the state of your project at a current point in time

Branches: the different flows of time

GitHub

A way to host your repository online for other people to see / collaborate on

Owned by Microsoft

Not open-source itself.

Errors

git diff-index --quiet HEAD --

Detects if files have changed

Commits

HEAD the current commit HEAD^1 the parent commit

Commands

push

pull

Runs git fetch followed by git merge

fetch

Downloads the latest history from Github Does nothing to the working files

merge

Creates a merge commit, forcing multiple different repo histories together

add

commit

rebase

This is a linear alternative to merge

diff

Compares different commits, allowing you to find the modified files

Use --name-only if you don't want to output the raw text changes, but just grab the paths of the changed files