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
@filipiz
Copy link

filipiz commented Mar 22, 2011

I don't know exactly why you need to see the log and how you use that info.
I use GitX (on Mac). Just fetch, and refresh to see the logs and the changes... if that's good, then merge...

Actually, the experimental fork of GitX is pretty better because of the fetch, pull and push buttons on the bottom. :)

http://brotherbard.com/blog/2010/03/experimental-gitx-fork/
https://github.com/brotherbard/gitx

@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