I am trying to get a list of all the branches available on my repository using Python with this code :
import subprocess
branches = ["All"]
command = "git branch -r"
branch_list = subprocess.check_output(command)
for branch in branch_list:
print branch
branches.append[branch]
What I want is to have something like :
print branches[0] # is "All"
print branches[1] # is "branch1"
print branches[2] # is "branch2"
etc etc
but instead of that I have
print branches[0] # is "All"
print branches[1] # is "b"
print branches[2] # is "r"
print branches[3] # is "a"
print branches[4] # is "n"
print branches[5] # is "c"
print branches[6] # is "h"
etc etc
Thank you for your time and your help.