0

I am migrating repos from svn to git but the git command I am using only pushes master branch and I need to manually checkout feature branches to push it to remote.

git push --all origin
git push --tags

Above command does not push feature branches. Is there a git command that can do it for me without I checking out the branch and push it to remote?

user_dev
  • 1,357
  • 3
  • 20
  • 46
  • This question is confusing. If you don't have the branches locally and their not on the server, where are they? I'm guessing you have multiple remotes? – Liam Oct 26 '18 at 15:53
  • I'm presuming that you have a svn remote and a git remote and you want to move everything out of the SVN one to the GIT one, follow the [instructions on this answer](https://stackoverflow.com/a/3972103/542251). *If you want to keep other remote branches in your repository, you want to create a local branch for each one manually*. How many branches do you have?! Ask yourself, do I need a lot of branches? Typically old branches should be deleted. – Liam Oct 26 '18 at 15:57
  • @Liam git branch -a shows all the local branches so yes I do have those branches as part of git history – user_dev Oct 26 '18 at 15:58
  • @Liam I agree that the old branches should be deleted but that's a requirement I need to fulfill. – user_dev Oct 26 '18 at 16:00
  • I think your confused as to how GIT works. GIT and SVN work in very different ways. Now that said, I'm not really sure what your problem is anymore. Why do you want to push multiple branches? You only work on one branch at a time? – Liam Oct 26 '18 at 16:01
  • Well maybe I am not clear enough. I am not at all confused, the requirement is clear, I am not looking for best practices with this question. I am only looking for if there is a way I can push(remote) all the svn branches after I processed it to be a git repo with one command something like git push --tags. Hope it makes it clear – user_dev Oct 26 '18 at 16:04
  • 1
    did you try `git push --mirror` [doc](https://git-scm.com/docs/git-push#git-push---mirror)? It will push all your refs, just delete the remote HEAD ref afterwards with `git push --delete`. Be careful: this might delete some remote branches that you don't have in your clone – bernard paulus Dec 04 '18 at 10:29

1 Answers1

4

try this

git push origin local_branch:remote_new_or_existing_branch_name
Liam
  • 27,717
  • 28
  • 128
  • 190
BlueMir
  • 41
  • 3
  • No this means I need to list out every local branch. I am looking for something similar like git push --tags which pushes all the tags to remote – user_dev Oct 26 '18 at 16:01