Skip to content

Instantly share code, notes, and snippets.

@andylolz
Last active January 17, 2018 11:44
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 andylolz/22928b61f85e0e270984b2ea79147dbb to your computer and use it in GitHub Desktop.
Save andylolz/22928b61f85e0e270984b2ea79147dbb to your computer and use it in GitHub Desktop.

Generating a nice diff of the changes in the v2.03 upgrade

First, fork this repo: https://github.com/IATI/IATI-Schemas

Then, do the following:

# clone version-2.02 branch to v2.03
git clone https://github.com/[your-username]/IATI-Schemas -b version-2.02 IATI-Schemas-v2.03

# clone version-2.03dev branch to v2.03dev
git clone https://github.com/[your-username]/IATI-Schemas -b version-2.03dev IATI-Schemas-v2.03dev

cd IATI-Schemas-v2.03

# force push to fix the broken version-2.03 branch
git checkout -b version-2.03
git push -f origin version-2.03

# make a new branch
git checkout -b v2.03diff

# copy xsd files from v2.03dev to v2.03
cp ../IATI-Schemas-v2.03dev/*.xsd .

# stage and commit all non-whitespace changes to activities schema
# NB this sorcery is from https://stackoverflow.com/a/45486981
git diff -U0 -w --no-color iati-activities-schema.xsd | git apply --cached --ignore-whitespace --unidiff-zero -
git commit -m 'v2.03 activities schema updates'

# stage and commit all non-whitespace changes to organisations schema
git diff -U0 -w --no-color iati-organisations-schema.xsd | git apply --cached --ignore-whitespace --unidiff-zero -
git commit -m 'v2.03 organistions schema updates'

# stage and commit all non-whitespace changes to common schema
git diff -U0 -w --no-color iati-common.xsd | git apply --cached --ignore-whitespace --unidiff-zero -
git commit -m 'v2.03 common schema updates'

# disregard other changes
git checkout .

# push it
git push origin v2.03diff

# if you use `hub`, you can create the pull request
hub pull-request -b version-2.03 -m 'v2.03 updates'

Here’s the result: https://github.com/andylolz/IATI-Schemas/pull/1/files

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