forum/git pull remote git-annexgit-annexhttp://git-annex.branchable.com/forum/git_pull_remote_git-annex/git-annexikiwiki2013-11-27T22:47:37Zcomment 1http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_1_9c245db3518d8b889ecdf5115ad9e053/joey2013-11-27T22:47:37Z2011-12-06T16:43:29Z
<p>You're taking a very long and strange way to a place that you can reach as follows:</p>
<pre>
git pull remote
git annex get .
</pre>
<p>Which is just as shown in <a href="http://git-annex.branchable.com/walkthrough/getting_file_content/">getting file content</a>.</p>
<p>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:</p>
<pre>
git pull remote master
git fetch remote git-annex
git annex get .
</pre>
<p>Or, eqivilantly but with less network connections:</p>
<pre>
git fetch remote
git merge remote/master
git annex get .
</pre>
<p>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. <img src="http://git-annex.branchable.com/smileys/smile.png" alt=":)" /></p>
comment 2http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_2_0f7f4a311b0ec1d89613e80847e69b42/Matt2013-11-27T22:47:37Z2011-12-06T23:23:29Z
<p>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:</p>
<pre><code>You asked to pull from the remote 'rss', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
</code></pre>
<p>Rookie mistake indeed.</p>
comment 3http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_3_1aa89725b5196e40a16edeeb5ccfa371/Matt2013-11-27T22:47:37Z2011-12-21T16:06:25Z
<p>hmmmm - I'm still not sure I get this.</p>
<p>If I'm using a whole bunch of distributed annexs with no central repo, then I can not do a <code>git pull remote</code> without either specifying the branch to use or changing default tracked remote via <code>git branch --set-upstream</code>. The former like you note doesn't pull the git-annex branch down the latter only works one-at-a-time.</p>
<p>The docs read to me as though I ought to be able to do a <code>git pull remote ; git annex get .</code> using anyone of my distributed annexs.</p>
<p>Am I doing something wrong? Or is the above correct?</p>
I think Matt is right.http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_4_646f2077edcabc000a7d9cb75a93cf55/Adam2013-11-27T22:47:37Z2011-12-23T14:04:44Z
<p>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.</p>
<p>The man page says of "git annex merge":</p>
<pre><code>Automatically merges any changes from remotes into the git-annex
branch.
</code></pre>
<p>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.</p>
<p>My master branches do not track any specific upstream branch, because
I am operating in a decentralized fashion. Therefore the error
message caused by <code>git pull $remote</code> succeeded in encouraging me to
instead use <code>git pull $remote master</code>, and this excludes the git-annex
branch from the fetch. Even worse, a git newbie might realise this
and be tempted to do <code>git pull $remote git-annex</code>.</p>
<p>Therefore I think it needs to be explicitly documented that</p>
<pre><code>git fetch $remote
git merge $remote/master
</code></pre>
<p>is required when the local branch doesn't track an upstream branch.
Or maybe a <code>--fetch</code> option could be added to <code>git annex merge</code> to
perform the fetch from all remotes before running the merge(s).</p>
comment 5http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_5_4f2a05ef6551806dd0ec65372f183ca4/joey2013-11-27T22:47:37Z2011-12-23T16:50:26Z
<p>My goal for <code>git-annex merge</code> is that users should not need to know about it, so it should not be doing expensive pulls.</p>
<p>I hope that <code>git annex sync</code> will grow some useful features to support fully distributed git usage, as being discussed in <a href="http://git-annex.branchable.com/forum/pure_git-annex_only_workflow/">pure git-annex only workflow</a>. I still use centralized git to avoid these problems myself.</p>
comment 6http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_6_3925d1aa56bce9380f712e238d63080f/Adam2013-11-27T22:47:37Z2011-12-23T17:14:03Z
Extending <code>git annex sync</code> would be nice, although auto-commit does not suit every use case, so it would be better not to couple one to the other.
comment 7http://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_7_24c45ee981b18bc78325c768242e635d/Adam2013-11-27T22:47:37Z2011-12-23T17:24:58Z
P.S. I see you already <a href="http://source.git-annex.branchable.com/?p=source.git;a=commitdiff;h=a0227e81f9c82afc12ac1bd1cecd63cc0894d751">fixed the docs</a> - thanks! <img src="http://git-annex.branchable.com/smileys/smile.png" alt=":)" />
git tweak-fetchhttp://git-annex.branchable.com/forum/git_pull_remote_git-annex/comment_8_7e76ee9b6520cbffaf484c9299a63ad3/joey2013-11-27T22:47:37Z2011-12-26T18:50:35Z
<p>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.</p>
<p>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.)</p>
<p>(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.)</p>