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?

  • How to manage Nuget repositories config files on git, when developing on Windows and Mac (files always modified)?
  • Repo sync hangs
  • Lock merge, when rebase is possible - bitbucket
  • What's the -practical- difference between a Bare and non-Bare repository?
  • Create a Git repo with two independently updatable repos
  • Git - Same User, Different Machine - Clone?
  • Multiple django-apps on python path or in project
  • Git subrepositories
  • 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
    
    Git Baby is a git and github fan, let's start git clone.