I am in the process of migrating a git repository from one host to another. for 3 months, we cloned the project with git clone (no --mirror), and we started adding changes to this new cloned repo. Meanwhile, the original repository was also being updated with changes. Now we need a smart way to migrate the whole old repository (with all the history), keeping in mind that we have already added changes to a cloned version that we also want to keep
            Asked
            
        
        
            Active
            
        
            Viewed 59 times
        
    0
            
            
         
    
    
        anyavacy
        
- 1,618
- 5
- 21
- 43
- 
                    Would a fetch and merge/rebase not do it? – evolutionxbox Jan 15 '19 at 14:17
- 
                    what about the git history from the original repository ? – anyavacy Jan 15 '19 at 14:22
- 
                    Assuming the "original repo" is your remote called "origin" you can use `git fetch --all`. https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches – evolutionxbox Jan 15 '19 at 14:23
- 
                    the original repo has a different name. let's call it `old-origin`. `git fetch --all` will fetch from both origins, I guess. that should be fine, but then I will just need to `git pull --rebase #(master branch)`, then `git push --all`? – anyavacy Jan 15 '19 at 14:53
- 
                    Just for nomenclature's sake, I think you meant "remotes" instead of "origins". --- `git fetch old-origin` will only fetch from remote `old-origin`. – evolutionxbox Jan 15 '19 at 14:58
- 
                    yeah both "remotes" I meant :D – anyavacy Jan 15 '19 at 15:06
- 
                    Once the fetch has happened, merge each of your branches with their remote counterpart `git checkout my-branch && git merge old-origin/my-branch`. This is where you should fix any conflicts. – evolutionxbox Jan 15 '19 at 15:23
- 
                    Definitely don't do `git pull --rebase` on your branches. That will change the history and cause lots of trouble. Follow @evolutionxbox's advice and merge the branches from the two remotes instead. – joanis Jan 15 '19 at 15:53
- 
                    thnks guys. i ll try that – anyavacy Jan 15 '19 at 16:22