Skip to content

Instantly share code, notes, and snippets.

@rrhinox
Last active February 26, 2024 10:57
Show Gist options
  • Save rrhinox/4c3b6c1365f26b9b6ef967ef89307e16 to your computer and use it in GitHub Desktop.
Save rrhinox/4c3b6c1365f26b9b6ef967ef89307e16 to your computer and use it in GitHub Desktop.
When the number of git projects starts to get large having a way to share and update many different projects prompted me to find a couple of commands useful when working in teams on many projects. I hope they are useful to someone :)

Linux and MINGW64 compatible git utilities

Pull changes for all local projects

In the root folder of your workspace run this find command to pull changes from remote repo (on the last branch):

find . -name .git -type d -print -execdir git pull \;

Create your favourite alias for example, for sync changes with git pull :

alias git-sync='find . -name .git -type d -print -execdir git pull \;'

Extract all repo url from all git project in a file:

find . -name .git -type d -print -execdir grep -Ri url {}/config > $(pwd)/repo-urls.out \;

then substitute all "url =" pattern with "git clone" command :

sed -i 's/url =/git clone/g' repo-urls.out

Output Example after substitution :

cat repo-urls.out

./project-name/.git

git clone https://companydomain@gitlab.com/organization/project-name/_git/project-name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment