title: how to rebase with git lfs?
body: <p>I've got a repoA with 2 lfs tracked files. I'm bringing that repo into repoB like this</p>
  <pre><code>cd repoB
  git fetch repoA somebranch
  git checkout -b temp FETCH_HEAD
  git rebase someotherbranch
  </code></pre>
  <p>this prints several lines of &quot;Applying: ...&quot; and then</p>
  <pre><code>Using index info to reconstruct a base tree...
  Falling back to patching base and 3-way merge...
  error: Your local changes to the following files would be overwritten by merge:
      Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
  Please, commit your changes or stash them before you can merge.
  Aborting
  error: Failed to merge in the changes.
  Patch failed at 0340 update server
  The copy of the patch that failed is found in: .git/rebase-apply/patch
  
  When you have resolved this problem, run &quot;git rebase --continue&quot;.
  If you prefer to skip this patch, run &quot;git rebase --skip&quot; instead.
  To check out the original branch and stop rebasing, run &quot;git rebase --abort&quot;.
  </code></pre>
  <p>How do I fix this? <strong>NOTE: THIS FILE DOES NOT EXIST IN repoA</strong>. This issue seems to be entirely related to issues with git lfs.</p>
  <p>git status showed this</p>
  <pre><code>$ git status
  rebase in progress; onto 5af1f30
  You are currently rebasing branch 'gamepad' on '5af1f30'.
    (all conflicts fixed: run &quot;git rebase --continue&quot;)
  
  Changes not staged for commit:
    (use &quot;git add/rm &lt;file&gt;...&quot; to update what will be committed)
    (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)
  
      modified:   Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
      deleted:    Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.sha256.bytes
  
  no changes added to commit (use &quot;git add&quot; and/or &quot;git commit -a&quot;)
  </code></pre>
  <p>Note: I tried just adding and committing the 2 files (voodoo) and then <code>git rebase --continue</code> which kept going until the next time the file was modified in the history at which point it got a similar error. I did the same thing and it finally finished. But then when I tried to rebase that onto another branch I got</p>
  <pre><code>Downloading Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (7.48 MB)
  Error downloading object: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (4743b094eeab821140773213ebabdaa81c9ac2eb1be1108e70e8d51ae52873dd)
  
  Errors logged to /Users/gregg/src/hft-unity3d/.git/lfs/objects/logs/20160603T213456.110362284.log
  Use `git lfs logs last` to view the log.
  error: external filter git-lfs smudge -- %f failed 2
  error: external filter git-lfs smudge -- %f failed
  fatal: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes: smudge filter lfs failed
  Could not apply dc378b5d715103e9af0ee805ff2a3be1159739aa... add lfs support
  </code></pre>
  <p>Which kind of suggests I have no clue how to use git lfs correctly.</p>
  <h2>update 1</h2>
  <p>So it turns out you have to install git lfs in every repo. This is not at all clear from <a href="https://git-lfs.github.com/" rel="noreferrer">the docs</a> which say</p>
  <blockquote>
  <p>You only have to set up Git LFS once.</p>
  <pre><code> git lfs install
  </code></pre>
  </blockquote>
  <p>It turns out it's once per repo not actually <em>once</em>.</p>
  <p>Then, reading though <a href="https://github.com/github/git-lfs/issues/" rel="noreferrer">the issues</a> it needs to know where to get the remotely stored files. It does this based on whatever remote branch is being tracked so, starting over</p>
  <pre><code>git clone git@github.com/me/repoA
  cd repoA
  git lfs install
  git remote add repoB git@github.com/me/repoB
  git fetch repoB
  git checkout -b temp repoB/somebranch
  </code></pre>
  <p>This starts to checkout repoB/somebranch into a temp but fails with</p>
  <pre><code>Downloading Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (7.48 MB)
  Error downloading object: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (f8c42a7c55f610768ce50ff93d09fc63fa897de867290dafee2e84d64e10de4e)
  
  Errors logged to /Users/gregg/temp/delme-hft-unity3d/.git/lfs/objects/logs/20160603T231351.670335751.log
  Use `git lfs logs last` to view the log.
  error: external filter git-lfs smudge -- %f failed 2
  error: external filter git-lfs smudge -- %f failed
  fatal: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes: smudge filter lfs failed
  </code></pre>
  <p>AFAIK I'm tracking the correct branch now. That's the same branch on the same remote that the files were uploaded with.</p>
  <h2>update 2</h2>
  <p>Starting over with the last one but changing <code>origin</code> to point to the repoB after cloning repoA gets further</p>
  <pre><code>git clone git@github.com/me/repoA
  cd repoA
  git lfs install
  git remote remove origin
  git remote add origin git@github.com/me/repoB
  git fetch repoB
  git checkout -b temp origin/somebranch
  </code></pre>
  <p>This works where as before it failed</p>
  <p>But now</p>
  <pre><code>git checkout -b other master
  git branch --set-upstream-to origin/somebranch
  git rebase master temp
  </code></pre>
  <p>Fails at the same place as before</p>
  <pre><code>Using index info to reconstruct a base tree...
  Falling back to patching base and 3-way merge...
  error: Your local changes to the following files would be overwritten by merge:
      Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
  Please, commit your changes or stash them before you can merge.
  Aborting
  error: Failed to merge in the changes.
  Patch failed at 0358 update server
  The copy of the patch that failed is found in: .git/rebase-apply/patch
  
  When you have resolved this problem, run &quot;git rebase --continue&quot;.
  If you prefer to skip this patch, run &quot;git rebase --skip&quot; instead.
  To check out the original branch and stop rebasing, run &quot;git rebase --abort&quot;.
  </code></pre>