0

I am working on a python script that takes a repository name from a properties file and it either it does

git remote add -f origin repository_name

or if it finds a .git folder already there, it just fetches a branch.

My problem is, the above command takes lot of time .So I will want to find that the repository name that is coming from properties file is same as represented by .git folder(or we can say someone already ran above command). If it is same then go ahead and just checkout a branch else run the above command.

I will want to put a check that if the repository that's coming from properties is same as represented by .git folder.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Ahmad
  • 2,110
  • 5
  • 26
  • 36

1 Answers1

0

you can read GIT_DIR/.config file and parse it in python's ConfigParser model.

For Python you can consider using GiT python bindings

http://libgit2.github.com/

forvaidya
  • 3,041
  • 3
  • 26
  • 33