Part III · Shell and commands
30. Git
- 30.1How git stores your workA commit is a snapshot of the whole project, plus its author, message and parent commit(s). It's named by a hash of all that.
- 30.2Undoing things in gitCommitted work is almost never lost: the reflog remembers every place a branch has been. Uncommitted edits are the fragile part.
- 30.3Merge or rebase?Both bring another branch's work into yours. Merge adds a commit with two parents and keeps history as it happened. Rebase replays your commits on top of the other branch: a straight line.
- 30.4Remotes: fetch, pull and pushA remote is another copy of the repository, usually origin on GitHub or GitLab. Your copy is complete: most commands work offline.
- 30.5Configuring gitThree levels: system (/etc/gitconfig), yours (~/.gitconfig) and the repository's (.git/config). The closest one wins.