Skip to content

Instantly share code, notes, and snippets.

@holgerschurig
Created December 8, 2016 21:24
Show Gist options
  • Save holgerschurig/56a84a7347c1761f36785a21cc9bb6e3 to your computer and use it in GitHub Desktop.
Save holgerschurig/56a84a7347c1761f36785a21cc9bb6e3 to your computer and use it in GitHub Desktop.
How to stay up track changes in git projects
#!/bin/sh
# Step 1: clone projects into directories with a leading "git-":
#
# git clone http://foo.org/foo.git git-foo
# git clone http://bar.org/bar.git git-bar
#
# Step 2: some hours/days/weeks later, run this script:
#
# ./update.sh
#
# Step 3: profit!
for i in git-*; do
(
LOGFILE=${i#git-}.diff
echo "---> $i"
test -f $LOGFILE && continue
cd $i
git pull 2>&1
git log --reverse -p ORIG_HEAD..HEAD | tee ../$LOGFILE
test -s ../$LOGFILE || rm -f ../$LOGFILE
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment