0

A git repository was taken from a local system (localhub) and created on the project wide system (companyhub). However, the history was lost because the various files were committed at one time.

That is, the repository git@companyhub:projects/myproject.git was created without the history.

The git log on companyhub now reads

Adding project processing to company git hub

with the date on which this was done.

Is there a way in which I can take the history which still exists on localhub and put it in to the repository which has been created on company hub.

I want to have git@companyhub:projects/myproject.git show the same log history as git@localhub:projects/localproject.git

Note that the files do not change. it is the history shown by git log that is to be fixed.

Would going into the clone created by localhub and issuing

git push git@companyhub:projects/myproject.git

work. I am reluctant to try it without first getting confirmation from someone who knows better.

sabbahillel
  • 4,357
  • 1
  • 19
  • 36
  • Would it be easier to add the new repository as a remote and simply push the code to the new server? – osowskit Sep 12 '16 at 15:18
  • @osowskit Yes, however, the point is that the original error was already done. I updated the question. Is that clearer? – sabbahillel Sep 12 '16 at 16:08
  • 1
    Possible duplicate of [How can I combine Git repositories into a linear history?](http://stackoverflow.com/questions/15780956/how-can-i-combine-git-repositories-into-a-linear-history) – Ajedi32 Sep 12 '16 at 16:43

1 Answers1

0

One way to go is to pull your old repository from the newer one. That way, you keep all the existing commit history

  • When I issued a pull in the directory created by the clone of the old one, the files are pulled from the new one, the history (git log) does not change. What I want is to be able to update the history as shown by git log – sabbahillel Sep 12 '16 at 16:10