Search code examples
gitgit-mergegit-pullgit-bare

Git: Pulling changes into a newly cloned bare repository from an existing (similar) repository


I was originally working on a repository (say /path/to/d_orig) and maintaining versions on it using Git. I wish to move into a newer version of the repository which has been updated by others and contains some major changes.

In order to keep my current version and the newer version separate, I have a cloned from the bare repository of the newer version at a different location (say /path/to/d_bare). After cloning, how can I pull/merge the changes from d_orig to d_bare?


Solution

  • You can add a remote of origin repo in your bare repo like this.

    git remote add origin_repo <git url of origin repo>
    

    Once the remote of origin repo has been added you can pull the changes from origin repo into your bare repo like this.

    git pull origin_repo <branch-name>
    

    Here origin_repo is the remote we have added which refer to your origin_repo, you can have your own name also for the remote.