I thought I'd followed the walk through when initially setting up my repos.
However I find that I have to do the following to sync my annex's.
git pull remote master
git checkout git-annex
git pull remote git-annex
git checkout master
git annex get .
Has something gone wrong? I see no mention of syncing git-annex repos in the walk-through...
You're taking a very long and strange way to a place that you can reach as follows:
Which is just as shown in getting file content.
In particular, "git pull remote" first fetches all branches from the remote, including the git-annex branch. When you say "git pull remote master", you're preventing it from fetching the git-annex branch. If for some reason you want the slightly longer way around, it is:
Or, eqivilantly but with less network connections:
BTW, notice that this is all bog-standard git branch pulling stuff, not specific to git-annex in the least. Consult your extensive and friendly git documentation for details.
Doh! Total brain melt on my part. Thanks for the additional info. Not taking my time and reading things properly - kept assuming that the full remote pull failed due to the warning:
Rookie mistake indeed.
hmmmm - I'm still not sure I get this.
If I'm using a whole bunch of distributed annexs with no central repo, then I can not do a
git pull remote
without either specifying the branch to use or changing default tracked remote viagit branch --set-upstream
. The former like you note doesn't pull the git-annex branch down the latter only works one-at-a-time.The docs read to me as though I ought to be able to do a
git pull remote ; git annex get .
using anyone of my distributed annexs.Am I doing something wrong? Or is the above correct?
I got bitten by this too. It seems that the user is expected to fetch remote git-annex branches themselves, but this is not documented anywhere.
The man page says of "git annex merge":
I am not a git newbie, but even so I had incorrectly assumed that git annex merge would take care of pulling the git-annex branch from the remote prior to merging, thereby ensuring all versions of the git-annex branch would be merged, and that the location tracking data would be synced across all peer repositories.
My master branches do not track any specific upstream branch, because I am operating in a decentralized fashion. Therefore the error message caused by
git pull $remote
succeeded in encouraging me to instead usegit pull $remote master
, and this excludes the git-annex branch from the fetch. Even worse, a git newbie might realise this and be tempted to dogit pull $remote git-annex
.Therefore I think it needs to be explicitly documented that
is required when the local branch doesn't track an upstream branch. Or maybe a
--fetch
option could be added togit annex merge
to perform the fetch from all remotes before running the merge(s).My goal for
git-annex merge
is that users should not need to know about it, so it should not be doing expensive pulls.I hope that
git annex sync
will grow some useful features to support fully distributed git usage, as being discussed in pure git-annex only workflow. I still use centralized git to avoid these problems myself.git annex sync
would be nice, although auto-commit does not suit every use case, so it would be better not to couple one to the other.The git tweak-fetch hook that I have been developing, and hope will be accepted into git soon, provides some abilities that could be used to make "git pull remote" always merge remote/master. Normall, git can only be configured to do that merge automatically for one remote (ie, origin). But the tweak-fetch hook can flag arbitrary branches as needing merge.
So, it could always flag tracking branches of the currently checked out branch for merge. This would be enabled by some setting, probably, since it's not necessarily the case that everyone wants to auto-merge when they pull like this. (Which is why git doesn't do it by default after all.)
(The tweak-fetch hook will also entirely eliminate the need to run git annex merge manually, since it can always take care of merging the git-annex branch.)