{"thread":{"id":"39160","subject":"Cloning or pushing only files that have been updated","startedAt":"2015-04-25T21:17:09Z","lastAt":"2015-04-25T21:54:36Z","messageCount":2,"participants":["cl@qgenuity.com","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"260005","messageId":"054116d47b69ca56f3369369df9fb4d8.squirrel@www.qgenuity.com","threadId":"39160","inReplyTo":null,"subject":"Cloning or pushing only files that have been updated","fromName":"","fromEmail":"cl@qgenuity.com","sentAt":"2015-04-25T21:17:09Z","receivedAt":"2015-04-25T21:17:09Z","isPatch":false,"sender":{"key":"cl@qgenuity.com","avatar":null},"body":"Hi,\n\nI have two sets of files.\n\nA_Old is a large unversioned directory tree containing many files.\n\nA_Updated is a git repository containing the files from A_Old, some of\nwhich have been modified. A_Updated also contains new files.\n\nI am looking for a way of cloning only the new or modified files from\nA_Updated to A_Old. I would like A_Old to become a clone of A_Updated,\nhowever I don't want to download the entire archive because of access\nspeed issues.\n\nTimestamps on all files are accurate.\n\nAny ideas?\n\n- J\n"},{"id":"260009","messageId":"553C0D1C.2010301@kdbg.org","threadId":"39160","inReplyTo":"054116d47b69ca56f3369369df9fb4d8.squirrel@www.qgenuity.com","subject":"Re: Cloning or pushing only files that have been updated","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2015-04-25T21:54:36Z","receivedAt":"2015-04-25T21:54:36Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 25.04.2015 um 23:17 schrieb cl@qgenuity.com:\n> I have two sets of files.\n>\n> A_Old is a large unversioned directory tree containing many files.\n>\n> A_Updated is a git repository containing the files from A_Old, some of\n> which have been modified. A_Updated also contains new files.\n>\n> I am looking for a way of cloning only the new or modified files from\n> A_Updated to A_Old. I would like A_Old to become a clone of A_Updated,\n> however I don't want to download the entire archive because of access\n> speed issues.\n>\n> Timestamps on all files are accurate.\n\n1. Create a commit from the files in each of the directories.\n\n2. Use git rev-list --objects --all | sort to generate a sorted list of \nobjects in each of the repositories.\n\n3. In A_Old, generate a pack from the objects that are not in A_Updated \nusing 'comm' of the objects lists piped into git pack-objects.\n\n4. Transfer this pack from A_old to A_Updated.\n\n5. Use git fast-export --no-data in A_old.\n\n6. Use git fast-import in A_Updated to import the commit that you have \nin A_Old into A_Updated.\n\n7. In A_Updated, git reset --soft the-commit-from-A_Old && git commit. \nNow you have a second commit with the updated state.\n\n8. Use git-remote to connect the two repositories and to push or pull \nthe updated state.\n\n-- Hannes\n"}]}