Skip to content

Instantly share code, notes, and snippets.

@nzakas
Created March 21, 2011 23:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzakas/880432 to your computer and use it in GitHub Desktop.
Save nzakas/880432 to your computer and use it in GitHub Desktop.
Get updates list before merging
# I was trying to figure out how to get a list of changes made remotely on Git
# before applying. Here's what I came up with.
# First, get the latest data from the origin
git fetch origin
# Then, get the changes and output to a file
git log HEAD..origin/master > changes.txt
# Merge changes in
git merge origin/master
@wyattdanger
Copy link

Unless you only need changes from origin, you can remove 'origin' from the first command, and simply run
git fetch

@nzakas
Copy link
Author

nzakas commented Mar 22, 2011

This is part of a CI script I'm writing. The basic idea is that I only want to do a new build if there have been changes. I use the changelog to determine if there have been changes, so:

if [ -s changes.txt]; then
    git merge origin/master
    #do build
fi

Seems to be working so far.

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