github - Merge two copies of the same git repository -


i made git repo foo , started working. twenty commits later, copied on files repo new directory bar , created new git repo. have twenty commits on bar repo, too.

how merge 2 repos have 1 clean history? want rid of first commit in bar repo , append rest foo repo.

you add second repository remote first repo , rebase commits onto branch of foo repository.

inside foo repository add bar repository

$ git remote add bar <path-to-bar> $ git fetch bar 

now find commit want rebase (in case second one) , do

$ git rebase master <hash-of-second-commit> 

depending on how 2 repositories differ apply cleanly, or might have resolve merge conflicts.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -