Earlier this year, the Destroy All Software screencasts were free to download. I grabbed a few that sounded interesting to watch.
These are notes of new things I learned.
Difference in philosophy between git and Mercurial. Some Mercurial
users don't believe that version control history should be changed.
In git, changing history is a commonly used feature. Examples:
rebase
to reorder commits; doing commit --amend
to change
commit messages.
-
Breaks tests.
You may rewrite history and find tests don't work against every commit.
Making tests work against every commit before pushing can be useful if e.g. want to ensure that performance benchmarks run for every commit.
Counter-argument: possible to use commands like:
git rev-list --reverse master | while read rev; do git co $rev && git clean -fd && python runtests.py; done; git co master # Run tests on all master commits, then return to current master commit.
and
git rev-list --reverse origin/master..master | while read rev; do git co $rev && git clean -fd && python runtests.py; done; git co master # Run tests on all commits in master that have diverged from origin/master, then return to current master commit.
CAUTION: these use
git clean -fd
. -
Clobbers existing work.
Rewriting history and pushing will overwrite a remote.
Counter-argument: have to force push to do that. When doing
git push -f
, should consider it carefully before doing so. -
Loses your work; can't revert back.
Changing history will lose work you've done, so can't return to it.
Counter-argument: git maintains commits for at least 30 days. Can use the reflog to go back in that time. Shouldn't fear changing history as the reflog does allow you to fix your mistakes.