Created
March 21, 2011 23:08
-
-
Save nzakas/880432 to your computer and use it in GitHub Desktop.
Get updates list before merging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Unless you only need changes from origin, you can remove 'origin' from the first command, and simply run
git fetch
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
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