0

What I am looking for is the following:

There is a remote git repository on Github that has multiple branches besides the master branch.

With that set as the remote of my local git, I would like to be able to pull all of those branches into separate directories, and be able to run git commands for all of them while in the main/master directory that has record of them.

So, for example, these are the branches in the remote repository:

Master
Branch1
Branch2
Branch3

Say then I make the following commands:

mkdir somedir 
git init
git remote ... blah blah

So, I connect the remote to the initialized repo, from there I would like to be able to fetch and pull the branches, but instead of it being in somedire I want them and the code in them separated into directories of their own.

From there, I would able to commit, merge, or do whatever with the branches and have it reflect on the local directories as well as be able to push to the remote.

I do not really know I should look at, but how should I go about doing this?

  • You'd need to check out the branches into separate folders to do this. What you're trying to do is have the code on your machine similar to how SVN would do it - is SVN an option for you so you can work the way you want/need to without all the additional management overhead? – gabe3886 Jun 27 '18 at 16:15
  • 1
    *"pull all of those branches into separate directories"* -- Git branches are not different (sub-)projects. They are alternative history lines. You can easily do what you want by checking out each branch in a separate clone of the repo. The new versions of Git also allow [multiple working trees](https://git-scm.com/docs/git-worktree) for a single repo and you can use this feature instead of multiple clones. – axiac Jun 27 '18 at 16:16
  • @gabe3886 SVN or any other VCS isn't really an option as git is heavily integrated with the people I am working with. Unless, there is an easy way for me alone to use SVN for myself to do what I am looking to do and easily convert between git and SVN –  Jun 27 '18 at 16:17
  • Possible duplicate of [Multiple working directories with Git?](https://stackoverflow.com/questions/6270193/multiple-working-directories-with-git) – phd Jun 27 '18 at 16:32
  • INteresting @axiac I will look into the multiple work trees. –  Jun 27 '18 at 16:59

0 Answers0