I have reviewed many existing pages on SO about this subject and none of the solutions works. I am running git lfs migrate on an existing repository with 80,000+ commits, and thousands of tickets and pullrequests. git lfs migrate rewrites commit history and we are applying it to all branches. I want to then force push all the changed branches to the original repo. This is the ultimate goal. Now for the tests I have been running that are the direct subject of this post.
In my tests, I clone the target repo and run the migration locally before attempting to set and push to a new repository at a different github url. After this is complete I go to GitHub and alas all the branches are gone except master. I've tried using git push origin -u --all and --mirror and other variants posted here on SO all to no avail. I even got creative and just ra git push --mirror but still only master appears on the GitHub repo page. The documentation at https://git-scm.com/ is clear but it does not have the expected affect.
Any advice would be greatly appreciated!
 
                        
I know this is an old post but since I've been struggling with the same for the past 2 months or so, here is my 50 cent on the matter. When cloning the existing repo using
git clonecommand so indeed only branch, default branch is being checkout. if you then executegit lfs migrate --everything --include =....then the git lfs migrate will only take place on this one single branch that was checkout. then if you try togit push --mirror #newUrl#, the --mirror flag is using the --prune option (as discussed here - Git push --all vs --mirror). This is why you will only see one branch after using thegit push --mirrorcommand. Basically in order to overcome this annoying issue we:git lfs migrate --everything --includegit push --mirror #newRepoUrl#Thegit push --mirrorhere did two things: a. pushed all branches to the new repository b. pushed all refs as well, so branches, tags, replace, etc. This second option is really important as the--everythingflag in thegit lfs migratecommand does taking care of all the refs, but regulargit pushor evengit push --all(that covers only refs/branches as far as I know) andgit push --tags(that covers refs/tags) won't push any other refs that might be changed during thegit lfs migratecommand. Using thegit push --mirror #newRepoUrl#seems the only valid option.Sorry for this longs post. If anyone has something to fix \ add \ change \ comment please feel free as it seems this topic is quite confusing.