Sneakernet with Git?

So your Git repo is on a USB stick. How do you merge it back into the real repo?

When remote connection is not possible, you can put a Git repo on a stick. But how do you merge without getting so many conflicts?

Why would you get so many conflicts? Well, since they are the same files, and you are changing them in local and remote, you will probably change the same lines. Or my present Git understanding is missing something, like a force option?

If you don’t care about branching and all that, just use file synchronization tools.

Here is an example session where the USB stick contains a Git repo:

git fetch  path-to-repo-on-stick
git merge -s recursive -Xtheirs --no-commit FETCH_HEAD

... now inspect, test, etc. ...

git commit

1. Get fetch will get the new stuff from the “remote” repo that is on the USB stick.

2. Now we want to merge this into the local repo.
-s recursive is the strategy.
-X gives the option to the strategy
–no-commit we want to inspect and test before we actually merge.
FETCH_HEAD is where the new stuff gets placed (the commit object?)

4. We visually inspect and run tests here. Nothing broke?

6. Commit the changes in the working set, that was created at 2.

Posted by a Git newbie, so “be careful out there”.

The git-bundle command is the standard way of doing this. Find out how to use it: Git’s Little Bundle of Joy.

Does using bundling remove the excess conflicts?

Further Reading

Leave a Reply

Your email address will not be published. Required fields are marked *