How to connect unrelated git stories?

we have a rather strange git story in our project. Firstly, another project has appeared that may have the following history:

repo1:

a---b---c

then there was our project that had

repo2:

u---v---w

since we need repo1 in the repo2 code, the smart programmer used read-tree to read the last commit (c) repo1 in w, so now we had

u---v---w---w'

where w 'had commit c without its history. Then, some changes were made to both repositories, which led to the following stories:

a---b---c---d---e

u---v---w---w'---x---y

repo1 . , ( , git ), git .

, ? "" , .. - :

a---b---c---d---e
          \
u---v---w--w'---x---y
+4
1

repo2 repo1

git add remote repo1 url_of_repo1

repo1

git fetch repo1

repo2

a---b---c---d---e  repo1/master

u---v---w--w'  master

, repo1 repo2 .

merge rebase

merge

git checkout master
git merge repo1/master

a---b---c---d---e  repo1/master
                  \
u---v---w--w'------x  master

rebase

git checkout -b rebasing repo1/master
git rebase master
git branch -f master
git checkout master
git branch -D rebasing


u---v---w--w'-a---b---c---d---e  master

, . .

, , w'

git checkout master
git reset master^1

master w commit

+3

All Articles