Scripts that people might want. Or not.
A bunch of scripts for manipulating multiple git repos.
Expects a file in the git repos parent directory called repos
.
This file can be generated by make_repo_file
.
Currently most scripts use repos
to work out which directories to work on.
Going to use flogging org as an example. So the flow is:
mkdir flogging
cd flogging
#Checkout your flogging repos into this directory...
make_repo_file
Edit repos to contain the directories you commonly work on in repos
, or leave as is for all repos.
Note it won't update as repos are added.
Change to branch mybranch in all repos.
repodo 'git checkout -b mybranch'
Make some changes in a repo. What's the status ?
statuses
Rebase from remote master.
rebase_from_master
Keep developing.
Test.
testall
Push every single branch upstream:
repodo 'git push origin HEAD:mybranch --set-upstream'
Back to master and remove the branch:
repodo 'git checkout master; git branch -D mybranch'
Make sure you're back up to date:
rebase_from_master
Profit.
Given a collection of directories under an optional top level directory with an optional name prefix, run a command (relative to each directory or global) in each directory in a separate tmux pane. e.g.
mkdir -p somedir/someprefix-project1
echo '#!/usr/bin/env sh' >somedir/someprefix-project1/somescript
echo 'pwd' >>somedir/someprefix-project1/somescript
echo '#!/usr/bin/env sh' >somedir/someprefix-project2/somescript
echo 'echo "Project 2 !"' >>somedir/someprefix-project2/somescript
echo 'pwd' >>somedir/someprefix-project2/somescript
chmod 755 somedir/someprefix-project1/somescript
chmod 755 somedir/someprefix-project2/somescript
# Run './somescript' in somedir/someprefix-project1 and somedir/someprefix-project2 in separate tmux panes.
# Ctrl+C <wait for processes to end>, Enter to exit...
command='./somescript' dir_prefix='somedir/someprefix-' tmux_command project1 project2
# Same as above but just show command in pane rather than executing it
dry_run=1 command='./somescript' dir_prefix='somedir/someprefix-' tmux_command project1 project2
Pipe in another command and use it to execute commands with {}
placeholder. Queries before each command execution.
E.g. Query removing each file altered in git working tree:
git status --porcelain | cut -c 4- | doq rm {}
E.g. Create a script removing only those files respond with "y" to:
git status --porcelain | cut -c 4- | doq echo rm {} | tee -a removal_script
# Each file you say yes to adds a `rm ...` line to removal_script
chmod 755 ./removal_script
./removal_script