1

For example, I have a git repo called Parser with a branch called Production. Then, there is a repo called ReParser with master branch.

I need to replace Parser/Production with Reparser/master, both files AND commit history. How can I do this?

WhilseySoon
  • 322
  • 4
  • 14
  • 1
    Wouldn’t [this previous question](http://stackoverflow.com/questions/1683531/how-to-import-existing-git-repository-into-another) work for you? – zoul Dec 12 '16 at 08:54

1 Answers1

2

Go to Parser repo.

$ git add remote reparser <reparser/repo/url>  # add a new remote named reparser
$ git fetch reparser                         # sync with 'reparser'

$ git checkout master                        # checkout to master
$ git branch -D Production                   # delete existing local 'production' branch
$ git checkout -b Production                 # create and checkout 'new production'

$ git pull reparser master                   # replace parser/Production with reparser/master
$ git push -f origin HEAD                    # force push to remote Production of Parser 
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73