- You have Git branches
mainand branchstaging. - You need to reset
stagingexactly 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
stagingis now exactly in the current state of branchmain - The commit history of branch
stagingis now erased, and mirrors the commit history ofmain