Transferring files between git repositories including history

Sometimes you have to transfer a file from one GIT repository to the other. You also need to preserve the history, either to give credits to authors, or simply to know why certain parts of code do exist.

First you have to export all desired files in a patch. Make sure you are running this command from git repository directory:

git log –pretty=email –patch-with-stat –reverse –full-index –binary — <file or directory> > <patch filename>

the patch now contains all commits containing changes to specified files. The next step is to navigate to target repo directory and apply patch:

git am –committer-date-is-author-date < <patch filename>

committer… flag forces commits from patch to maintain their original dates. Otherwise all applied commits would have current date. Sometimes you get a message:

Patch is empty.  Was it split wrong?

If you would prefer to skip this patch, instead run “git am –skip”.

To restore the original branch and stop patching run “git am –abort”.

The reason might be that there are merge commits without actual changes in the history. If you encounter this error just skip empty commits using

git am –skip –committer-date-is-author-date

make sure to include –committer flag, otherwise all consequent commits would have todays date.

Грамотная внутренняя и внешняя оптимизация необходима при продвижении сайта и раскрутке его в интернете topodin, С его помощью можно легко проверить, не получил ли кто-нибудь посторонний доступ к вашему ящику приватбанк курск кредитная карта