Git is a separate folder for each branch. Customization

I need to have 3 branches in 3 separate folders. (I know this is not git's way of doing things, but I need to do this for some reason).

Lets say the repo name my_proj_repo.git I created a folder called prodv1on my local system:

git clone url:/my_proj_repo.git

Now I went into the folder prodv1and copied the files from the server, and then:

git commit -am "initial import"
git push origin master

This pushed the files to management. Now I have created two more folders, such as on my local system

stagingv1
devv1

I want to create two local and remote branches with names:

staging // this local branch points (push/pull) to staging remote branch
dev     // this local branch points ((push/pull) to dev remote branch

And these two branches should be in the appropriate folders:

staging ==> stagingv1 folder
dev     ==> devv1 folder

I tried a few things, and I probably messed it up. Can someone point me to the commands / steps to get all this setup as I wanted?

, stagingv1 git clone <repo>. master. , staging .

+5
2

, , ,

$ git branch <name_of_your_new_branch>

" ", "" .

/

Step 1 $ git branch [name_branch#1]

Step 2 $ git branch [name_branch#2]

Step 3 $ git branch [name_branch#3]

...

Step 4 $ git push --all
Step 5 md Folder #2
Step 6 $ git clone [URL]
Step 7 $ git checkout [name_branch]
+8

, , ( ), git 2.5 git worktree.

, git , :

  • 0 ( )
  • 1 ( )
  • n > 1, , n-1

, :
git worktree add <path to branch> <branch name>
, , :
git worktree add -b <new branch name> <path to branch> master

. , .

+2

All Articles