Skip to content

Git tools #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 21, 2020
Merged

Git tools #258

merged 7 commits into from
Nov 21, 2020

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Nov 21, 2020

No description provided.

desc "git #{command} on all the repos"
task command => :clone do
run_command "git #{command} #{options}".strip
end
end

desc 'git push on all the repos'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this script, works for all subdirectories:

#!/bin/bash

all() {
  (
    cd $2
    cd ..
    echo $(bash -c "$1" 1>/dev/null 2>&1 && echo "[+]" || echo "[ ]") $(pwd)
  )
}
export -f all

echo "$*" for all repos
export COMMAND="$*"
find . -maxdepth 2 -type d -name '.git' | xargs -P 10 -L1 -I{} bash -c 'all "$COMMAND" "{}"'
~/source/rspec-dev/repos $ git checkout drop-old-rubies
git co drop-old-rubies for all repos
[ ] /Users/pirj/source/rspec-dev/repos/rspec-collection_matchers
[ ] /Users/pirj/source/rspec-dev/repos/rspec.github.io
[+] /Users/pirj/source/rspec-dev/repos/rspec
[+] /Users/pirj/source/rspec-dev/repos/rspec-mocks
[+] /Users/pirj/source/rspec-dev/repos/rspec-support
[+] /Users/pirj/source/rspec-dev/repos/rspec-expectations
[ ] /Users/pirj/source/rspec-dev/repos/rspec-rails
[+] /Users/pirj/source/rspec-dev/repos/rspec-core

If you push it somewhere on the PATH, it's usable for other projects if you happen to work with dissected monoliths.

@JonRowe JonRowe merged commit d27313d into main Nov 21, 2020
@JonRowe JonRowe deleted the git-tools branch November 21, 2020 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants