I need to regularly extract the git logs for all branches of several repositories. While I could clone them and then perform a git fetch, I thought about saving some disk space and time and only cloning them as bare:
git clone --bare repoUrl
After the clone, all logs and branches are up to date.
I can issue git log --all and I can see all the changes up to the clone moment.
However, I am not able to fetch changes from the remote repo when it gets updated. I.e. if I issue:
git fetch --all and then git log --all, I don't see any of the change that happened in the remote repo.
How can I update the state of my local repository when the remote receives new commits?
I have tried:
git fetchbut it doesn't seem to get any update (i.e.git log --alldoesn't show any change).git fetch origin master:masteronly updates the master branchgit branch -rdoesn't show anythinggit branch -ashows only the branches available at the moment of the clonegit remote -vshows correctly the url of the remote repository.
I found the solution reading this answer related to a similar question (I only need to extract the logs, not to pull the code).
After cloning, I've to add:
git config remote.origin.fetch "+*:*"so that git can keep track of all the branches, even remote ones. Then, issuing
git fetch --all --pruneandgit log --allI can see all the changes.