Skip to content

Instantly share code, notes, and snippets.

@Orc
Last active June 15, 2020 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Orc/4570dec28249d547d80ff0755ed020df to your computer and use it in GitHub Desktop.
Save Orc/4570dec28249d547d80ff0755ed020df to your computer and use it in GitHub Desktop.
#! /bin/sh
HOSTS="tinyd gateway gehenna credit downbelow netbsd"
if [ ! "$1" ]; then
echo "usage: $0 {cmd}" 1>&2
exit 1
fi
cmd=$1
shift
case $PWD in
${HOME}/*)target=`echo $PWD | sed -e "s:^${HOME}/::"`
;;
*) echo "$0 can't parse directories that aren't in $HOME :-(" 1>&2
exit 1
;;
esac
for x in $HOSTS; do
#echo git $cmd $x:$target $@
git $cmd $x:$target $@
done
#! /bin/sh
set -x
git branch -m master main
git push git@github.com:Orc/`basename $PWD`.git -u --all
git.everywhere push -u --all
ssh.everywhere "git checkout main &&
git branch -d master &&
find .git/config .git/refs .git/*HEAD -type f -print |
xargs grep -l master |
while read it; do
sed -e s/master/main/ < \$it > $$
mv $$ \$it
done &&
find .git/refs -name master | while read it; do
mv \$it \`dirname \$it\`/main
done"
These scripts are built around my sccs configuration; all my managed sources are in $HOME/Src (~orc/Src/discount, ~orc/Src/levee,
...) and that is uniform on all of my build/test/development machines. If I cd into one of my trees and run mainline.sh (below)
it will pick up the project name from the directory name and know where to go on every other one.
mainline.sh goes in $HOME/Src, git.everywhere & ssh.everywhere go in $HOME/bin.
Be aware that mainline.sh as written pushes to my mirror on github, so that most certainly needs to be changed.
It is also advised to do a `ssh.everywhere git status` before renaming the mainline branch, b/c git gets unhappy about the idea of
deleting a branch that has uncommitted changes.
#! /bin/sh
HOSTS="tinyd gateway gehenna credit downbelow netbsd"
if [ ! "$1" ]; then
echo "usage: $0 {cmd}" 1>&2
exit 1
fi
case $PWD in
${HOME}/*)target=`echo $PWD | sed -e "s:^${HOME}/::"`
;;
*) echo "$0 can't parse directories that aren't in $HOME :-(" 1>&2
exit 1
;;
esac
for x in $HOSTS; do
#echo ssh $x "cd $target && $@"
ssh $x "cd $target 2>/dev/null && ( echo $x':'; $@ )"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment