Merge shared commits into a master branch?

I have a Git repository that has many commits and separate code, say

/Proj1 

I also have another Git repo in which there is 1 commit in it which is not a general commit,

 /Proj2 

How can I combine the two repositories and is it right to show the story with the parent commit? Basically, there are no common commits between the two repositories, but I want to have one repo with two sets of code. I would like it to look like this:

 proj2 commit proj2 commit proj1 commit (root) 

I know rebase is an option, but not sure if using --onto replaces the root commit (which apparently does if I select from a remote repo and rebase --onto --root master ).

I tried using Git subtrees, which initially look like they work, but when I use git-tfs to push my commits, but I get an error

warning: parent ... does not belong to the monitored TFS branch (not checked in TFS) and will be ignored

and commits are not actually push-ups (also likely because it is a subtree).

Edit: I want to get only 1 repo (Proj1), but I have PROJ2 transactions after completing Proj1 on the main branch.

+7
git tfs git-tfs
source share
1 answer

Cupcake helped solve this problem. Here is one way to do this:

In ProjA, add Proj B as your remote:

 git remote add projb C:\projB 

Do a git fetch to capture all the commits of the main projB branch:

 git fetch projb 

Relocate, starting from the root of projB to the end (end) of the projA master branch:

 git rebase --onto master --root projb/master 

And this! There are potentially less risky ways to accomplish this, but it definitely solves it for now.

+13
source share

All Articles