Reputation: 2752
I want to make my local version of a repository (not a single branch, all branches) the new remote version.
Is there a way how to do that or do I have to overwrite/add each branch manually? It is not an initial commit. I just want to overwrite everything that is online with a local version that is more correct than the one currently online (after some bad git operations I want to restore it with a backup version).
Upvotes: 1
Views: 31
Reputation: 36765
You can use
git push origin --mirror
From the manpage
--mirror
Instead of naming each ref to push, specifies that all refs under
refs/
(which includes but is not limited torefs/heads/
,refs/remotes/
, andrefs/tags/
) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration optionremote.<remote>.mirror
is set.
(emphasis mine)
Upvotes: 3