merge - git merging only recent changes from one repository to another which is an unrelated snapshot (not a clone) -


i have 2 git repositories: internal , external. internal repo has our full history. external repo has 1 commit of snapshot of internal repository of 3 weeks ago. graphically looks this:

a01  | a02  | a03  | a04  --> snapshot b01  | a05  | a06 - a07  |     | a08    |  |    / a09  /  |  /  | /  +  | a10  | a11  | a12 

my question how best merge commits a05 through a12 local copy repository b? (i'll squash them internally before pushing them our public-facing repo)

a , b unrelated repositories (b not created clone of a; took checkout copy of repo of commit a04 , checked them new repo b)


the twist in of (and if weren't true, continue use snapshots) have file renaming. repo contains refactoring commits files renamed , moved. if take snapshot of a12 , commit b01, somehow have tell git how relate files before , after move (like hg rename -a in mercurial); information in repo a's history , not want have recreate it.

other people suggesting manually copying checked out version repository b. want squash commits a01, a02, , a03 onto b01. ensures don't make careless omissions when commit repo b.

now, simple if , b in same repo, they're not. fortunately, can achieve similar adding b remote in copy of a:

~/a $ git remote add external ssh://path/to/b ~/a $ git fetch external 

b has been set remote external. has separate dag, in same repository, can squash commits. unfortunately, think you'll have know commit created b01 from. there's arcane git command tell you, it's easy enough figure out yourself. example, commit a04. (obviously shorthash in reality.) squash:

~/a $ git rebase --interactive a04 --onto external/master 

here, external/master refers b01 in dag.

in editor appears when run above command, change action on every commit first squash. (in vim, easy block mode.) should this:

pick a03 squash a02 squash a01 

exit editor , allow git apply changes. can push changes external remote repository.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -