Git: First rewinding head to replay

Solution 1:

git fetch origin; git reset --hard origin/<branch>

Solution 2:

I have 3 branchs:main,feat-dev,func。(feat-dev from main,func from feat-dev)

I use these step:

  1. on func, git rebase origin/feat-dev; git push --force;
  2. on feat-dev, git rebase origin/main; git push --force;
  3. on func, git rebase origin/feat-dev.

git tell me same messages: "First, rewinding head to replay your work on top of it..."

On func, I just use

git push --force

Then everything goes fine.