Learn the fundamentals of how Git works - what are commits and branches exactly. Then learn how to rewrite history - merge, rebase, squash and amend commits. Lastly some git workflows and good practices.
with Bitkeeper) ▸ For use in Linux kernel development ▸ Actually the Linux Philosophy ▸ Uses concepts from POSIX filesystem ▸ Stores snapshots not diffs ▸ All data stored in .git directory in delta compressed form ▸ Precise commands ▸ "Git" means an idiot (British Slang)
Can work entirely independently of others ▸ Even without internet ▸ Remote - URL to push the code to ▸ clone brings the project, creates origin and master
Message + Author (name, email) + Timestamp + Snapshots of all files + Parent(s) reference = checksum ▸ Everything is checksummed internally, each version of each file has checksum ▸ Checksum - SHA-1, Unique, 40 character hex (20 bytes)
a tree structure - Log tree - HISTORY ▸ Branches are nothing more than pointers to commit objects ▸ Pointers change - refer to different object ▸ Remote and local branches ▸ HEAD - symbolic pointer pointing to current branch
commits are inline ▸ Just move the pointer to the next commit ▸ Non-fast-forward ▸ Commits not-inline ▸ Create a new snapshot and a merge commit ▸ Looks at nearest common parent to create new snapshot
Change commit message ▸ Usually the latest commit ▸ Example: ▸ Can add files before committing ▸ git commit —amend ▸ amends the latest commit ▸ git rebase HEAD~3 ▸ then select to edit a commit - amends previous commit
▸ Changing history has challenges ▸ DO NOT change shared history ▸ DO NOT change commits on branches that others have based their work on ▸ Any of these operations changes the commit and all commits based on that: ▸ rebase, cherry-pick, squash, amend
entity ▸ Write good commit messages ▸ Imperative mood in the subject line ▸ Fix the flash message on password change ▸ Fixed password change ▸ Details in the message ▸ Use rebase instead of merge on your own PR ▸ Unless no-one else is working on the same branch ▸ Branch names with hiphens