- You have Git branches
main
and branchstaging
. - You need to reset
staging
exactly to the state of branchmain
.
Be sure you really want to do this:
- This is a destructive operation, and will erase the commit history of the branch
- This will affect any other developers using the branch.
git checkout main
git pull origin main
git checkout staging
git reset --hard main
git push --force origin staging
- Your branch
staging
is now exactly in the current state of branchmain
- The commit history of branch
staging
is now erased, and mirrors the commit history ofmain