how to apply an older patch in local GIT repository?

Git (revision control): Is it possible to pull more than one repository at the same time?

  • I have about 20 repos at github which are "subdirectories" of a Webproject for people who collaborate with my. The get all changes i have a shellscript "above" the local repositories which goes into every repository and calls git pull. This means 20 connections to github, waiting and so on. Is it possible to tell git to pull all of this repos simultaneously from "above" instead of the shellscript?

  • Answer:

    To use submodules, do these at the root of your project's repository: git submodule add http://url/to/foobar relative/path/to/foobar git submodule add http://url/to/bazquux relative/path/to/bazquux git submodule init git submodule update Then, to update them: git submodule foreach git checkout master git submodule foreach git pull I don't think it parallelizes the tasks, though. Quick tip: everything after foreach is interpreted as though you've cd'd into each repository.

Kit Monisit at Quora Visit the source

Was this solution helpful to you?

Other answers

A new way to remap multiple Git repositories into one is Perforce Git Fusion.  You can define a new, virtual Git repo that contains the same content and history as the "subdirectory" projects. From the Git client point of view, this works like one big repo, and developers do not need to use submodule or subtree commands.  (You can also split out parts of an existing repo, or do whatever remixing you need.) When you push into the remapped repo, you can pull the same work into the original ones, which is useful if you want to contribute upstream or pull in a new version from a contributor at GitHub. More info: http://www.perforce.com/blog/121001/improving-git-experience-everyone (I am a regular Git user and employed as Technical Marketing Manager at Perforce Software.)

Don Marti

If your goal is simply parallelism and not coordination, you can just run them all in parallel from the shellscript. (If you need to coordinate versions, that's what 'git modules' are for). for i in [a b c d e]; do ( echo Pulling "$i" cd "$i" git pull )& BG="${BG} $!" done wait $BG echo Done

Bob Kerns

One of the big performance overheads of what you're doing is the need to constantly spawn and authenticate new SSH connections for each logical repository.There's an easy way to make this much, much more efficient.Add these two lines to the top of your ~/.ssh/config ControlMaster auto ControlPath ~/.ssh/control/%r@%h:%p What this does is it enables SSH to multiplex a single connection as long as the username, host and port values are the same ( which they are for github, they're all [email protected]:22 )Then, before doing your pull work, you spawn  a "master" background SSH connection. ssh -fNn [email protected] This creates a tty-less connection to github, and the "ControlMaster auto" in your means any subsequent connections to the same server will just re-use the existing one.So, lets compare:Normal: time ssh [email protected] Hi kentfredric! You've successfully authenticated, but GitHub does not provide shell access. real 0m2.925s user 0m0.034s sys 0m0.004s cpu 1.29% Setting up the connection: time ssh -fNn [email protected] real 0m2.613s user 0m0.045s sys 0m0.008s cpu 2.02% Now trying it with a pre-multiplexed connection: time ssh [email protected] Hi kentfredric! You've successfully authenticated, but GitHub does not provide shell access. real 0m0.447s user 0m0.002s sys 0m0.005s cpu 1.56% That just saved more than â…”rds  of the connection overhead.The only thing you have to worry about with this configuration is its unwise to do it on a shared resource, because it removes the authentication step from the connection setup, meaning anyone who can read your ~/.ssh/control/ path ( that is, you, and any programs you're running, whoever is root, and anyone who can sudo to you ) can potentially access any servers you've authenticated against before starting the master connection.If you want to limit this exposure so it only applies vs github, then you should move the Control statements statements to occur in a host-specific way only, by placing them under a Host github.com statement.Read man ssh_config for more details.

Kent Fredric

I've used mr (http://myrepos.branchable.com/ github https://github.com/joeyh/myrepos) for this.  It's not hugely powerful, but it's easy to use, free and open source).

David Goldfarb

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.