Cloning repository from local server missing commits

Viewed 29

--- Some background ---

I am running multiple docker containers on my server, each of them does git fetch on startup. The purpose is to update an in-docker repository (from github), since its state may be old, depending on the last time the docker image was built.

I tried an optimization to save internet throughput:

  1. Update a local repository on the host machine (from github).
  2. Then on each docker git remote set-url origin user@host_machine:/path/to/host/local/repo; git fetch

It turns out however that some updates are missing on the docker repositories. Tried it without docker, happens as well.

--- End of background ---

Here is what I'm doing:

  1. Clone a repository from github to local repo A.
  2. Clone local repo A to another local repo B.
  3. Update some commits on github.
  4. Git fetch on local repo A.
  5. Git fetch on local repo B.

At the end, some commits are found on A but not on B. (git log on origin/master shows different HEAD between A and B).

1 Answers

So, thanks to comment the answer is obvious.

On local repo A - origin/master refers to the master branch on github.

On local repo B - origin/master refers to the local master branch on repo A. After all origin is repo A.

So one must pull the branches on repo A in order to be able to see them on repo B. Thats it.

Related