➕ GIT: ⏬ Pulling from a different repository.
The Black Mamba🔥

The Black Mamba🔥 @blackmamba

About: 👨‍💻Full Stack Developer 📱Android ☕Java 🐍Python 🇰Kotlin 🅰️Angular 🇳Node JS ⚛️React 📦Serverless 🦈Docker 🔥Firebase ⚙️Reverse Engineering

Location:
God's own Country
Joined:
Jun 30, 2019

➕ GIT: ⏬ Pulling from a different repository.

Publish Date: Nov 1 '19
48 5

Recently while working on a freelance project, i came across an interesting scenario where the previous developer has maintained 2 repositories, one in gitlab and the other in heroku.

The gitlab account is a repository to hold the code, and the heroku repository is linked to the build pipeline. i have made changes to the gitlab repository and the changes needs to be made to the master branch of heroku repository.

This is a scenario which i have never encountered before. After some investigation i found out that, you would do this when you want to create a new app from the same base or core (that's meant to be its purpose, but the scenario here is different).

Coming to the solution,

  • Add the other repository as a remote
    git remote add upstream https://www.gitlab.com/something/somrepo.git
    (upstream refers to the gitlab repository)

  • Now the two remotes will be shown (Screenshot from Source Tree)
    Sourcetree

  • Now pull the changes from master branch of gitlab repository to heroku.
    git pull upstream master

  • Push the changes to the repository , now your heroku branch will have all the changes from the master branch of gitlab.

Twitter Follow

Comments 5 total

  • mihai
    mihaiNov 2, 2019

    sooo, can't you just ... use the heroku command to get the changes? to update?

    • The Black Mamba🔥
      The Black Mamba🔥Nov 3, 2019

      which heroku command? I don't have much experience in heroku

    • Kevin Ard
      Kevin ArdNov 3, 2019

      Even better - considering this is gitlab - why does it not use gitlab-ci to trigger builds?

      • The Black Mamba🔥
        The Black Mamba🔥Nov 3, 2019

        It's the first thing that i checked ,there was no ci setup and to create a runner you have to access the project settings, which can only be done by maintainer or admin and my role is developer.

        • Kevin Ard
          Kevin ArdNov 3, 2019

          Probably worthless here, but since we're talking about multiple remotes: you could totally add a third remote for your fork, which has gl-ci running on it for pushing to heroku. (Worthless, unless you intend to a) setup the project more correctly or b) out-fancy the other party in front of the client. Your call lol)

Add comment