0

I am backing up my hard drive of my project repos. I have a lot of work so I wanted to back them up on a SSD. When I just copied them, in the console, it showed a completely clean history. I wanted to essentially clone the repo but also keep my git history so it is an replica of what I have on my machine, with all of my commits in tact.

I looked into this solution here: How to move files from one git repo to another (not a clone), preserving history

I wanted to try taking out the commits as a patch. Of the best and simplest solutions was

cd repository git log --pretty=email --patch-with-stat --reverse --full-index --committer-date-is-author-date --binary -- path/to/file_or_folder > patch cd ../another_repository git am < ../repository/patch

Am I going about this the right way? or is there a better way to do this?

Community
  • 1
  • 1
Mark A
  • 1,532
  • 4
  • 15
  • 24

1 Answers1

0

If you want to backup, good solutions are:

  • use git clone --mirror
  • use git bundle feature (made for backup ;-))
Philippe
  • 21,230
  • 5
  • 41
  • 62