Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Last active April 8, 2018 02:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cgoldberg/f14f343e7700a2dbba4ccf6e3c351c28 to your computer and use it in GitHub Desktop.
Save cgoldberg/f14f343e7700a2dbba4ccf6e3c351c28 to your computer and use it in GitHub Desktop.
compare .plist changes between 2 git branches

Comparing p-lists (iOS Property List Files)

In OS X and iOS programming frameworks, property list files are used to store information about bundles and applications. Analyzing .plist files can tell you a lot about an application. It is often useful to compare content and view modifications to .plist files to understand what has changed between versions of an application.


  • list paths of .plist files modified between 2 branches
$ git diff --name-only "origin/branch1" "origin/branch2" -- 
  • show diffs from .plist modifications between 2 branches
  $ git diff --name-only "origin/branch1" "origin/branch2 |
  grep '.plist$' |
  xargs git diff "origin/$branch1" "origin/branch2" --

Example:
  1. create a script named pldiff.sh somewhere on your path:
    #!/usr/bin/env bash
    # Usage: pldiff branch1 branch2
    git diff --name-only "origin/$1" "origin/$2" |
    grep '.plist$' |
    xargs git diff "origin/$1" "origin/$2" --   
    
  2. make the script executable.
$ chmod +x pldiffs.sh
  1. clone git repo
    $ git clone --recursive https://source.corp.lookout.com/lookout/client-ios.git
    $ cd client_ios
    
  2. run pldiff.sh script with 2 branch names as args:
    $ pldiff.sh release-consumer-4.4.3 release-consumer-4.4.5
    

You should see a colored diff from every modification.


#!/usr/bin/env bash
# Usage: pldiff branch1 branch2
git diff --name-only "origin/$1" "origin/$2" |
grep '.plist$' |
xargs git diff "origin/$1" "origin/$2" --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment