git: how to push to master an unrelated repo
I had a git repo on bitbucket with a project. Then I decided to completely rewrite the project from scratch. Now, I have a clean working new version of the project I would push it to bitbucked but it say to me that there are merging conflits since the two repo doesn’t have a common history… I have been able to push new version to a different branch but I want that branch to be the master so that it represents the main development history. How can I push a new project to master?
- Sneaky ways to clone git repositories?
- Topic branches when working with a remote
- How to automatically align/sync a forked Github origin/master branch to upstream/master?
- How exactly does subversion store files in the repository?
- How to use a GIT post hook to apply the changes to a different repository
- trying to set up tortoise svn - newbie question
2 Solutions collect form web for “git: how to push to master an unrelated repo”
Assuming you have a remote to bitbucket called
bitbucket, and you are on the branch you want to be pushed to master, you could force push like this:
git push -f bitbucket master
You can also use git branch -m to rename the master branch to another one, then rename your different branch to master by using :
git branch -m master old-master git branch -m new-branch master git push -f origin master