Intermediate Git & Version Control
Q58 / 100

What does "git push --force" (or "-f") do, and why is it considered risky?

Correct! Well done.

Incorrect.

The correct answer is A) It overwrites the remote branch's history with the local branch's history, even if they have diverged — risky because it can permanently discard commits that others have already pushed or based work on

A

Correct Answer

It overwrites the remote branch's history with the local branch's history, even if they have diverged — risky because it can permanently discard commits that others have already pushed or based work on

Explanation

Force-pushing rewrites the remote history, which can cause collaborators to lose work or encounter confusing errors; "--force-with-lease" is a safer alternative that fails if the remote has changes you don't have locally.

Progress
58/100