I am building an application with an update (or upgrade) ability, I would Like to use git to pull and zip up only the files that have changed (this would be done from command line). What would the process be to do this?
Asked
Active
Viewed 446 times
0
-
http://stackoverflow.com/questions/4126300/git-how-to-get-all-the-files-changed-and-new-files-in-a-folder-or-zip this may be helpful – pktangyue Mar 15 '13 at 16:21
-
The files that have changed since when? Previous commit? Current revision? – Arjan Mar 15 '13 at 16:23
-
I know there is a `merge` option in `git`. See [this from GitHub](https://help.github.com/articles/syncing-a-fork). – Geremia May 26 '14 at 20:21
2 Answers
0
You could do something like this:
git pull
zip modified-files.zip $(git diff --name-only HEAD HEAD~1)

mkrnr
- 842
- 8
- 17
-
this will not work as it pulls ALL objects, I wat ONLY the changed files. – TheWebs Mar 15 '13 at 17:01
-
As @Arjan asked before: What do you mean with "changed"? I assumed you mean changes made by the last revision. – mkrnr Mar 15 '13 at 17:05
-
actually this IS what you want, you're just not seeing it. Git pull will update to the latest snapshot. If only half the files have been updated since the last pull, then only those file will actually be transferred from the remote to the local repo. The only flaky bit is the HEAD HEAD~1 part, which isn't general enough because there may be an arbitrary number of commits in the last pull. – Sébastien Dawans Mar 15 '13 at 17:06
-
Isn't there a `merge` option in `git`? See [this from GitHub](https://help.github.com/articles/syncing-a-fork). – Geremia May 26 '14 at 20:20
0
Provided you don't have to compile the code (say, just having the sources is OK), I think SVN adapts better to what you want.
With git, the default behavior is to download every object in the remote that your repo lacks.
SVN will just download the files that changed between your current revision and the target one.
I don't think I've understood the "zip up" part - what do you want to zip? The incoming changes? Changes made to the files locally?

mgarciaisaia
- 14,521
- 8
- 57
- 81
-
I refuse to use svn, unless i can integrate it with git to do this, by zip up I mean lit make an archive of all the changed files. – TheWebs Mar 15 '13 at 17:01
-
@TheWebs but you want your client to first download the updates and then zip the changed files, all in the client? – mgarciaisaia Mar 15 '13 at 17:42
-
no i pull the changes, i zip it up, i host the changes, you download what put up – TheWebs Mar 15 '13 at 18:23