git - the stupid content tracker
git [--version] [-C path] COMMAND [args]
Options you will use
config --global user.name/user.email- Your commit identity, stored in ~/.gitconfig.
init / clone URL- Create a repository, or copy a remote one.
status [-s]- What has changed and what is staged.
add PATH- Stage changes.
git add -Astages everything. commit -m MSG- Record the staged changes.
log [--oneline] [-N]- History.
diff [--staged]- Unstaged changes, or staged ones.
branch / remote -v- Branches, and where origin points.
push / pull- Publish or fetch+merge.
remote set-url origin URL- Repoint origin - how you switch HTTPS to SSH.
-C PATH- Run as if git was started in PATH instead of the current directory.
-c NAME=VALUE- Pass a configuration parameter for this one command only (e.g. -c user.name=ci-bot); it overrides the config files.
--no-pager- Do not pipe output into a pager.
-P- Same as --no-pager.
Gotchas
- GitHub removed password authentication over HTTPS: a push fails with "Support for password authentication was removed". Use an SSH remote ([email protected]:user/repo.git) with an ed25519 key.
- Git tracks FILES, not directories. An empty directory is invisible until it holds something - the convention is an empty .gitkeep.
Taught in
Try git in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.