0

I have a remote on GitHub with an old version of my site that's no longer in use. I've since made significant changes to the local copy and want to merge these changes in. Is there a way that I can do this and keep the history that's already in the remote repo.

Is it simply a matter of copying the old .git directory to the new project and doing a git push --force to replace the remote version with my local changes? I would like to keep the same remote repo (and its history) if at all possible.

Chris
  • 547
  • 6
  • 20
  • Huh? That's exactly what `git push` does. – SLaks Apr 18 '13 at 15:07
  • @SLaks, I'm aware of that, but mention this because I'm concerned about merge conflicts which might be especially nasty to resolve. I'm going to try Gabriele's suggestion as I hadn't heard about that use of the `recursive` option. – Chris Apr 18 '13 at 15:21
  • Merge conflicts can only happen if the remote has commits that your local copy doesn't have. (in which case `git push` would give an error and tell you to `git pull` first) – SLaks Apr 18 '13 at 15:39

1 Answers1

2

I think your question has already been answered just there.

Also, moving all files from one repo to another will keep the history of the destination repo (but not of the old one) so if you only need to keep the history of one of them, you can do it that way.

Community
  • 1
  • 1
Gus Monod
  • 110
  • 8