0

Doing support for a customer, they send their codebase and ask fix this, in the zip they send there is usually a .git folder I can use to see what they have been doing, typically several commits and a few new branches since the last time I saw it.

I cannot help feeling I should be able to merge the .git folder in the zip files I receive from time to time with a local copy of the repo I can keep any history, test harness etc that I use to support them.

The customer will not use something like git hub.

I am sure git can handle it, but I just cannot think of the runes. In effect I want it to create patches for everything past the last time I saw the repo and 'play them back' over mine.

Chris Aaaaa
  • 167
  • 1
  • 8

3 Answers3

2

Suppose you have your "working copy" in /home/me/project.

You can create a new (empty) directory /home/me/clientversion.
Unzip the latest copy of the zip archive in this directory.

From /home/me/project, you can add a remote pointing to that directory :

git remote add client /home/me/clientversion

Then execute git fetch client.

In the hostory of project, you will now see the state of the branches in clientversion as references to client/branch_name.

You can even pull, merge, track remotes ...

For updating : unzip the new zip archive inside clientversion, from project execute git fetch client.

--

Note : as suggested in other answers, git bundle will give you a cleaner way to manage the same thing.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • This is the way I went, customer was adverse to anything more. ps sorry for late response - I do not get email updates. – Chris Aaaaa Nov 10 '15 at 09:45
1

you can have them export their repository - or part of it - as a git bundle. See http://git-scm.com/docs/git-bundle

The command

git bundle create filename master

creates a file named filename which contains a bundled repository up to the revision marked by master. It is possible to include more than one branch/tip by listing them on the command line:

git bundle create filename master develop bugfix-mybug

and then you can add the bundle as a remote in your local repository and pull from it:

git remote add some-remote-name filename
git fetch some-remote-name
git merge some-remote-name/master

if you know the target repository already has some of the commits you can export partial bundles, by specifying a base commit for the bundle, or a time based. The commands:

git bundle create mybundle --since=10.days master
git bundle create mybundle version1...master

will create bundles including all commits needed to reconstruct the master branch, assuming the consumer of the bundle has respectively the 10 days ago version of master or the commit pointed by the tag/branch version1

When the client produces a new bundle for you to consume, just replace the file and run again git fetch some-remote-name

pqnet
  • 6,070
  • 1
  • 30
  • 51
1

You can treat the repository as a remote repository and pull changes from there, which you can either merge with your branch, or rebase your branch on.

Moving zip files around isn't the most efficient transport, but it works. It is sufficient to transport the .git directory, and you can use git gc before zipping it up to save space.

In the other direction, you can use git bundle to create a pack of just the missing parts, this will be easier to merge.

Simon Richter
  • 28,572
  • 1
  • 42
  • 64