-2

I have a local gitLab repository it has a master branch and other branches that I commit to. And after everything was tested I need to make so, that the code which is on a local gitLab (my-branch) would be constantly updated to a remote gitLab repository (test branch). The code that I'm constantly changing is not checked out from a remote gitLab repository but from a local gitLab master and

I don't know what kind of process should I use to make so that the tested changes would be found on a remote test branch which is on a remote gitLab.

At first I thought that maybe mirroring git lab repository would help, but that is forbidden for security and other reasons.

I can checkout a remote gitLab branch (test). And what I'm doing at a moment is I'm copying changed files to a remote test branch and then commit and then push the commit. But it feels awkward.

I've read on stackoverflow

git merge different repositories?

If you want to merge project-a into project-b:

cd path/to/project-b

git remote add project-a /path/to/project-a git

fetch project-a --tags git merge --allow-unrelated-histories

project-a/master # or whichever branch you want to merge git remote

remove project-a

My question is how to transfer changes in a git way from one repository to other repository without manually copy pasting changed files between repositories

miroana
  • 494
  • 3
  • 22

1 Answers1

2

how to transfer changes in a git way from one repository to other repository without manually copy pasting changed files between repositories

There is no other way.

Merging (ie, 3-way merging, which is what that word is commonly used for) requires both your branch and the branch you're merging into to have a common ancestor at some point (thus giving you the three points: base, local and remote).

Instead what you have is two separate repositories with no common ancestor between your branches. You might think that you do, because the code is "sort of similar-ish", but in a binary world all of your commit history is not the same, so it's different. There's no 3-way merge to be done here, all you have is a 2-way "merge" (ie diff the files and pick what you like the most).

If you want a better work flow, set up your repositories better.

Blindy
  • 65,249
  • 10
  • 91
  • 131