I have a git repository with long and strange history. I don’t know what the developers did with this repository and cannot control what they are doing with it now.
But I need to clone this repository (for redmine integration) and fetch all changes periodically.
What do I do:
git clone --bare git@git.server.com:/opt/git/repo
cd repo.git
git log
Now I can see all commits. Fine.
Next a developer make a commit in the main repository and I want to fetch all changes (all brances, tags and so on, and so on):
> git fetch --all
Fetching origin
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From git.gmcs.ru:/opt/git/ecco
* branch HEAD -> FETCH_HEAD
But if a ask the commit history I didn’t see that last commit which was made in the main repository. Why ?
If I post not enough information I am ready to give you all the needed.
Thanks in advance.
Updated
Here is a brach information in the original repsitory:
git branch -a
one
test
* master
release
Here is a branch information in the cloned repository:
git branch -a
one
test
* master
release
I can see last commits in the master branch of original repository, but can not find them in the master branch of cloned repository.
You should use
git pullor run
git mergeafter fetch to get fetched changesif you have a bare repository you can not do a pull, because a pull wants to merge with HEAD, which a bare repo does not have.
to update bare repository you can add it as
remoteto non-bare repository and push to it.But I think
--mirrorinstead of--barewill work for you as is.and then you can use
git remote updateto update mirrored repository