Git, how to move file or folder to another repository while retaining history?

1

I have 2 repositories:

  

/ var / www / project

     

/ var / www / project_disabled

I have a file in a specific folder inside my project repository and I want to move this file with all your git history from the project repository to the repository > project_disabled , how could I do this? Do you have a way?

This would help me maintain previous versions of an old project that is over 10 years old. and if you give any error I could go back with the file to the official dinovo repository with all its history.

    
asked by anonymous 31.01.2018 / 15:53

2 answers

1

I found a solution that is in this link here:

How to Move Changes Between Repositories Git Cherry-Pick

As I told the friend above I know that we are working the wrong way, but when this was proposed I had just entered as an intern and had not enough knowledge to question or argue, but at last I will talk to the staff and apply to solution that I found.

    
01.02.2018 / 11:06
3

You can simply clone your remote repository into another directory on your machine:

mkdir <repositorio-backup> -- cria o diretorio para o backup
cd <repositorio-backup>
git clone "https://github.com/path"

Another solution would be to create a backup branch, for example:

git checkout -b "branch-backup-master-2018/01/31"
    
31.01.2018 / 16:43