Can you provide a list of (all, or the most common) the operations or commands that can compromise the history in git?
What should be absolutely avoided?
Off the top of my head:
git commit --amend
will re-write the previous commitgit rebase
can rewrite multiple commits (rebase is also called when using git pull
with the --rebase
flag or the branch.$name.rebase
config option)git filter-branch
can rewrite multiple commitsgit push -f
can change the commit a branch points to (same goes for the git push origin +branch
syntax)git reset
can change the commit a branch points togit branch -f
can change the commit a branch points to (by recreating a branch with the same name)git checkout -B
can change the commit a branch points to (by recreating a branch with the same name)