If we want to use more than 15% of git features we have to master these commands.
Undoing / Rewriting History
git rebase– reapply commits on top of another basegit revert– create a new commit that undoes a previous onegit reset– move HEAD and optionally unstage/discard changesgit restore– restore working tree or index filesgit commit -v --amend– rewrite the last commitgit filter-branch– rewrite history in bulk
Inspection / Diff / Patch
git diff– show unstaged or staged changesgit diff-tree– compare tree objects (low-level)git apply– apply a patch to the working treegit format-patch– generate patch files from commits
Recovery / History Navigation
git reflog– log of where HEAD has been
Environment / Config Inspection
git var -l– list git logical variables
Selective Changes
git cherry-pick– apply specific commitsgit stash– shelve and restore uncommitted changes
Branch Navigation
git switch– switch branches (modern replacement forcheckout)
Commit / Revision Lookup
git name-rev– find symbolic name for a given revgit rev-parse– parse revision expressions to hashesgit rev-list– list commit objectsgit shortlog– summarise commit log by authorgit log --oneline --graph --decorate --all– visual commit graph
Tagging / Release
git tag– create or list tagsgit describe– describe a commit using the nearest taggit archive --format=zip --output=archive.zip HEAD– export a snapshot
Parallel Workspaces
git worktree– manage multiple working treesgit flow– high-level branching workflow (extension)
Authorship / Line History
git blame– show who last modified each linegit annotate– alias for blame with slightly different output
Search / Debug
git grep– search working tree or historygit bisect– binary search to find a bug-introducing commit
Tree / Index Inspection
git ls-tree– list contents of a tree objectgit ls-files– list tracked files in the index
Documentation / Help
git help -g– list concept guidesgit help everyday– common commands for daily use
- hooks... (preCommit etc)
- plugins ... (e.g. https://github.com/tj/git-extras)
- All the AI tools (can) use git
- Composer on PHP can use git repositories to manage packages and versions
- Online paas, CI/CD tools etc use git
- Learning curve is simpler and a ton of tutorials etc exist our there