📎 Webclip
10 new Git commands you should start using today
Ebenezer Don rounds up ten Git commands added since version 2.23, aimed at developers who know the basics but haven’t tracked what Git shipped in the years after. The commands fall into four groups: safer replacements for checkout’s overloaded behavior, tools that automate repository maintenance, commands for inspecting merges and rewritten history, and features for working across branches without disrupting the current one.
Fichamento#
git switch(Git 2.23) separates branch switching fromgit checkout, which used to also restore files and check out commits, so changing branches carries less risk of touching files by accident.git restore(Git 2.23) isolates undoing changes to files from branch operations that used to live insidecheckoutandreset, both of which could alter branch state if used carelessly.git maintenance(Git 2.29) automates garbage collection, packfile repacking and commit-graph updates that previously required runninggit gcandgit repackby hand.git sparse-checkout(Git 2.25) lets a working directory include only the directories a developer needs, useful for large monorepos where a full clone is wasteful.git log --remerge-diff(Git 2.35) replays a merge’s recorded strategy and shows the exact changes it introduced, which helps when reviewing how a conflict was resolved.git blame --ignore-rev(Git 2.23), backed by a persistent.git-blame-ignore-revsfile, excludes a bulk formatting commit from blame so authorship stays meaningful.git range-diffcompares two commit ranges and shows how a rebased or rewritten series of commits diverged from the original.git worktreecreates additional working directories tied to the same repository, so multiple branches can be worked on at once without switching or stashing.git rebase --update-refs(Git 2.38) keeps branch pointers and tags referencing rewritten commits in sync automatically after a rebase.git commit --fixup, paired withgit rebase -i --autosquash(fixup dates back to Git 1.7.4), marks a commit to be squashed automatically into an earlier target during an interactive rebase, keeping history clean without manual reordering.
