Reputation: 689
I have a project that is local (I am the only one working on it). I started using a local Git repo, but wanted to use GitHub to have a backup copy in the cloud for failure-proofing my PC and/or getting other people to work on the code.
I had been working on the 'main' branch, but then decided that I need a 'develop' branch so 'master' is a safe, up-to-date version (except new features being developed on 'develop').
I had tried to create the repo for main alone, and got lots of errors; 'git push origin master' came back with errors - usually (or most often) warning me my tip is ahead of the one on 'master'. However, probably by good fortune (or blindly following the instructions) got the 'develop' branch to exist on the remote repo, and was able to push the most recent version of 'develop' to GitHub.
However, I can't get master to work the same way.
How do you overwrite by force the remote repo? What I'd like it to show is the full commit history remotely, and to keep updating both branches.
In case it matters, GitHub forced me to go to 2FA...I had to generate an SSH key and use that for my password, but it works fine.
So I'm looking for a git approach which, in pseudo-code (which I know is wrong), looks something like this:
git push origin master --override
How do I zero out the remote repo for the master branch, then restart it so it brings up all the commits and files from the master branch?
Upvotes: 1
Views: 2265