2

The following topic describes how to copy commits from the one git repo to another. I have the similiar case but the directory structure in repos is different:

Simplified example:

Copy from repo: src/file.cpp

Copy to repo: src/logic/file.cpp

How to copy commits in such case ?

Irbis
  • 1,432
  • 1
  • 13
  • 39
  • Commits are snapshots. You can copy them the same way as in the question you linked to; they just end up with the files having the file names they had in the other repository, because if you have the *same commit* in your repository that's in the other repository, that commit, by definition, has the *same files* stored under *same paths*. If you want a *different* commit, note that `git cherry-pick` does that sort of thing—copies an old commit to a new different commit. Whether cherry-pick will rename any files, and if so, which ones, is a separate question. – torek May 27 '19 at 17:18

1 Answers1

1

The first thing you would have to do is to add the one of the repository as a remote with

git remote add <remote name> <remote URL>

and then fetch with

git fetch <remote name>

and use

git cherry-pick

to apply it to a commit

alextechtai
  • 101
  • 2