Reputation: 4692
If I am in master branch and want to create another branch named myAwesomeBranch but without checking out to it, I do:
git branch myAwesomeBranch
I would like to create several branches in one command from master, is that possible?
I tried with:
git branch myAwesomeBranch1 myAwesomeBranch2 myAwesomeBranch3
But it didn't work.
Upvotes: 0
Views: 1030
Reputation: 582
Alternatively, you can create multiple branches in one line (with multiple commands), by using ";"
git branch myAwesomeBranch1; git branch myAwesomeBranch2; git branch myAwesomeBranch3
Upvotes: 3
Reputation: 142402
image origin: https://www.lynda.com/Git-tutorials/Delete-local-remote-branches/664821/719158-4.html
Git doesn't support git branch <multiple branches>
the right way to do it is to use a shell script (single line will do it as well)
# loop over the branch list you wish to create
for branchName in {b1,b2,b3};
# Create the branch
do git branch $branchName;
# Set the upstream so you will be able to push the branch to the remote
git branch --track $branchName origin/$branchName
done
Upvotes: 0