Re: Cloning or pushing only files that have been updated
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Apr 25, 2015, 21:54 UTC
- Message-ID
- <553C0D1C.2010301@kdbg.org>
- In-Reply-To
- <054116d47b69ca56f3369369df9fb4d8.squirrel@www.qgenuity.com>
Am 25.04.2015 um 23:17 schrieb cl@qgenuity.com:
Show 13 quoted lines
> I have two sets of files. > > A_Old is a large unversioned directory tree containing many files. > > A_Updated is a git repository containing the files from A_Old, some of > which have been modified. A_Updated also contains new files. > > I am looking for a way of cloning only the new or modified files from > A_Updated to A_Old. I would like A_Old to become a clone of A_Updated, > however I don't want to download the entire archive because of access > speed issues. > > Timestamps on all files are accurate.
1. Create a commit from the files in each of the directories.
2. Use git rev-list --objects --all | sort to generate a sorted list of objects in each of the repositories.
3. In A_Old, generate a pack from the objects that are not in A_Updated using 'comm' of the objects lists piped into git pack-objects.
4. Transfer this pack from A_old to A_Updated.
5. Use git fast-export --no-data in A_old.
6. Use git fast-import in A_Updated to import the commit that you have in A_Old into A_Updated.
7. In A_Updated, git reset --soft the-commit-from-A_Old && git commit. Now you have a second commit with the updated state.
8. Use git-remote to connect the two repositories and to push or pull the updated state.
-- Hannes