Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy git repository to offline machine and pushing/pulling via memory-stick

I need to work on an offline machine, where I cannot access my repository. Now I also don't want miss out on using Git altogether.

Questions:

  • What is the best way to copy my repository onto an offline machine via memory-stick?
  • Is there a way to copy patches via the filesystem?

Edit: I should have stated, that I will have to hand over the memory stick to an administrator who will do the copying for me, i.e. I cannot mount the stick with my user.

like image 203
Beginner Avatar asked Jan 19 '15 14:01

Beginner


People also ask

Can I just copy a git repository?

Yes you can, but there's no need to copy the full working tree. You can copy just the . git folder without the working tree (i.e. as a "bare" repo) and then checkout the latest working tree on the other machine.


1 Answers

To copy a complete Git repo, you just have to copy the folder .git; it contains everything. Git uses safe file names and ignores time stamps inside of the repo, so this data is safe from the usual file system quirks.

On the target machine, create a folder, copy the .git folder inside. Now git checkout <branch> will get you a working copy.

If you want to move patches back and forth instead of the whole repo, then git format-patch <branch> creates them. The command will create all patches necessary to update a remote repo (i.e. the output will contain everything that hasn't been pushed, yet). you can also give it commit IDs (= start with this commit) or ranges.

To apply them, use git am < 0001.... on the remote repo.

Related:

  • http://rypress.com/tutorials/git/patch-workflows
like image 73
Aaron Digulla Avatar answered Sep 21 '22 06:09

Aaron Digulla