Blog Posts

How to update project without access to the Internet?

I had a problem recently -  my team need to copy few commits from old repository to another, new repo. I could just copy-paste pieces of code, but it looks so unprofessional. There is another, very simple way to do that.

Simply - you can prepare .patch file, which will update your code on the other branch. So run your git log and get your sha hash for the latest commit that you want to copy, and then run git format-patch SHA_HASH. You'll get as much as commits count that you choose .patch files, which contains regular diffs, as You can find under every change on the GitHub. Now just move these generated files to your second repository and run git apply 001-commit-message.patch and changes just pop into Your codebase.

Why I mentioned no-internet-access-updates? If you don't have access to the network It's safest method to pass on changes in Your code, so just copy files to usb stick and send some code in the envelope ;)