I recently received a \"forced update\" warning from git on a repository which only I commit to. I haven\'t done any re-basing so I don\'t know why this happened. What I w
What I want to know is, where should I look to find changes that have potentially been lost?
Kevin is right when writing that no local history will be lost. Still, some remote history may be lost, though it will be lost on purpose.
For example:
master
to S.master
in whatever way). master
to S. On fetch L will warn "forced update" because the previous branch tip is no longer reachable through the branch reference master
. But that's what D wanted anyway.
From Kevin's answer:
+ 7193788...a978889 master -> origin/master (forced update)
That line will appear only once. The reference to the possibly lost commit is 7193788.
If L wants to keep a reference to what might be lost, L might in above example issue: git branch whateverbranchname 7193788
. This may be done whatever the current state of the local checkout.
Or just git checkout 7193788
to explore it in detached head, then e.g. git checkout master
to get back to master. This may require to first commit any local change.
Notice that it's considered bad practice to push a changed history on a shared repository without proper cooperation with other users (because it causes extra work for people who have changes not yet shared).
In other words, no one should be surprised to see a "forced update" when doing a fetch on a shared repository. If someone pushed a bad commit, they should consider just pushing a corrected commit on top, not change existing history. Alternatively, they should get into agreement with others before pushing a changed history. That latter option is not possible on a public repository.