'How do i restore git push -f without git pull from remote repo? [duplicate]
Local repository A(branch feature/2.0 on A) in my system, i did git remote add associated with a remote repository B (branch main)git add remote repository B
and then nothing changed, direct git push -f push local repository A to the remote associated repository B, now the associated remote repository B is overwritten by the local repository A contentgit push -f global main
how to restore the content of the associated remote repository B,i have executedgit reflog --oneline
git reset --hard <commit-hash>
git push -f origin main
and repository B content is still overwritten by repository A,i want to restore repository B
Solution 1:[1]
i went back to my old local repo B and try git push -f
then it works.it will force update local to remote origin main
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gmrakari |