0

I am very new to GIT. At the moment, I have more than 50 repos that I have to clone. I was hoping to automate this task.

What I want to do is to store all my repo names in a text file. And write a script that will read from the text file and run git clone commands for all of them. Is this possible? I looked around a bit but not quite sure where to even start. Any help is much appreciated.

nachanus102
  • 33
  • 1
  • 4

2 Answers2

0
for /f %A in (textfile.txt) do echo %A

See for /?. Punctuation used with textfile.txt determines if it's a file to be read, a command, or a string.

eebbesen
  • 5,070
  • 8
  • 48
  • 70
Trigger
  • 681
  • 3
  • 4
  • It always blows my mind how hit and miss your answers are. If you're only going to point him in the right direction instead of actually answering his question, just leave a comment instead. – SomethingDark Apr 30 '15 at 08:40
  • @Trigger Thank you for your response. I see that it works for regular command prompt. But git clone commands are run in the bash right? Is there a way to send these commands from the text file to git bash or to access git bash from cmd prompt? I am using Git for Windows. – nachanus102 Apr 30 '15 at 23:51
  • The batch-file tag is Windows CMD or Command.com. See http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html – Trigger Apr 30 '15 at 23:57
0

You could use this command line instead of your text file:

find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;

I addition to this you have interesting tools like:

https://github.com/tatsuyaoiw/git-pull-all

orog
  • 89
  • 1
  • 2