2

I'm in a team of Java developers at my school. Keeping everybody's workspace in sync with the other is quite a pain.

"Well, why don't you use git" here's the catch: We have no network. All the computers in this lab are offline, the instructor is really uptight about security and he got tired of kids breaking his machines, so he just took them all offline. Convincing him to get the machines on the network even for this project is useless. There's no point he's too uptight.

So far my group has "made do" by logging every change we do, every class we create etc. Then we transfer all of our workspaces to one PC where some unlucky person has to manually make the changes. As the program becomes more complex and changes become harder to find, our method is going to become extremely pointless and even more painful and tedious.

I do have experience with git, and eclipse has this amazing Synchronize workspace tool, but I'm not sure how to make that work for say a workspace contained on a USB.

Another thought; a simple ad-hoc network. Say we have 2 PC's in our group just tether them together with a Ethernet cable and one can act as the server, and one can access stuff from it. This doesn't seem practical because I don't have admin and there isn't enough time to hack the PC and get admin access. Its windows 7 by the way.

Well i hope this is all the info you need, i'll be happy to answer any questions regarding the question and information that may have been overlooked.

Edit: There is no network infrastructure in the lab, I have no network or network infrastructure.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
BitShuffler
  • 103
  • 1
  • 8
  • 1
    Are the computers interconnected, but offline from the internet, or are they not even interconnected? In the first case, you could probably still use git (using one of yourselves as the 'remote'); in the latter case, maybe a git-repo on a USB device you pass around and sync up with? – tobias_k Jan 11 '16 at 15:14
  • I did ask the teacher as a matter of fact! He gave me the slowest way: use one computer and pass around the keyboard. Given the size of the project; you could probably get away with it for something like tic tac toe but chess? Probably not. And the computers are not interconnected, all of the machines's network infrastructure was removed. Hm a git repo on a usb sounds plausible. However how would i sync the changes? Have 2 usb's with 2 repositories and sync them how? – BitShuffler Jan 11 '16 at 15:22
  • I am not entirely sure how to do this with git (thus a comment, not an answer), but you can set another repo on your own computer as a remote. You should be able to do the same with a repo on a USB drive. Each of you has a git repo on his or her PC, and there's another one on the USB drive. You pass around the drive once a day or so, and everyone pulls from and pushes to that drive (you probably need two iterations until everyone is synced up) – tobias_k Jan 11 '16 at 15:25
  • Related: [Using GIT on USB stick for “travelling code”](http://stackoverflow.com/q/6389894/1639625) – tobias_k Jan 11 '16 at 15:30
  • That could work, and that's ideally what id want to do. However there seems to be some formalities involved with doing it that way. – BitShuffler Jan 11 '16 at 15:34

4 Answers4

4

Put your Git repo on the USB stick and make everyone commit/merge/rebase into it. Just configure new "remote" that will be stored there and regularly synchronize with the stick. That should work fine. Easier than building an ad-hoc network.

Update

For instance say you want to share and synchronize that repo on some USB stick (from Git repositories view):

enter image description here

Create a new bare repo on the stick:

S:\> git --bare init myProject

Add your repo as remote:

S:\myProject> git remote add myRepo M:\sources\learnyounode

Fetch all data from it including branches (hence *): (update I just realized you will want to have a different spec on the first fetch, instead of *:* use '+refs/heads/*:refs/heads/*'

S:\myProject> git fetch myRepo '+refs/heads/*:refs/heads/*'

The repository will be ready. Now on each of your machines, for each of your repositories do (in your repo folder):

M:\sources\learnyounode> git remote add mainRepo S:/myProject

Refresh Git repositories view in Eclipse to see:

enter image description here

You could also do that all using Eclipse instead of commandline Git, but it would be quite screenshot heavy description.

Michał Grzejszczak
  • 2,599
  • 1
  • 23
  • 28
  • I have done this. It works well. Just make sure the Git repo on the stick is "bare". – Erick G. Hagstrom Jan 11 '16 at 15:19
  • It does not have to be bare. In Git you just cannot update branch that is checked out, so with a non bare repo you can easily "detach head" by checking out a specific commit. This will let you commit to the repo. – Michał Grzejszczak Jan 11 '16 at 15:24
  • That sounds like it will work! Thank you. How would i go about creating this in Eclipse? Mainly how would i make sure the git repo stick is bare? – BitShuffler Jan 11 '16 at 15:25
  • 1
    It does not have to be bare, although you will most likely want a bare repo. Initialize a new repo on the stick with `git --bare init`, then `add remote` pointing to your own repo, `fetch` to it and you should be fine. To make all your colleagues workflow same, define new remotes in your repositories pointing to the repo on USB stick (each one of you can have a different path to accommodate drive letter). The you will be able to use basic Git workflow to synchronize with this new remote. – Michał Grzejszczak Jan 11 '16 at 15:29
  • As i mentioned in my question, the computers are windows 7 and i can't use git commands. I don't have admin privileges and I can't add git onto the machines. The only git option i have is eclipse. So would i be able to create a bare repository via eclipse? – BitShuffler Jan 11 '16 at 15:36
  • Bare is best. That way you don't have a Working Directory on the stick, so nothing can be checked out directly from that repo. Eclipse has a checkbox on the Create Repo dialog. It's easy to miss, so look closely. – Erick G. Hagstrom Jan 11 '16 at 15:39
  • Looks like there is a Windows Thumbdrive edition in the [downloads](http://git-scm.com/download/win) section, so you can install Git onto the USB drive right next to the repo. – tobias_k Jan 11 '16 at 15:39
  • If you're using Eclipse you don't need to download Git. Eclipse doesn't really use it. Eclipse has its own eGit/jGit stuff that is equivalent (more or less :/ ) to real Git. – Erick G. Hagstrom Jan 11 '16 at 15:42
  • The portable git looks promising. I'll see if i can set it up! – BitShuffler Jan 11 '16 at 15:45
  • Your answer has worked, thank you very much! marked as correct – BitShuffler Jan 11 '16 at 16:10
1

You could use Git, and use "bundles" to pass commits between team members. It would be equivalent to your method of logging changes and merging them manually, but less tedious and error-prone.

This article describes how to create and merge bundles.

legoscia
  • 39,593
  • 22
  • 116
  • 167
0

Even if your computers are not on a network, you can still use Git to do the code merging. Your basic setup should work like this:

  1. initialize a Git repository on one of the computers. This will be your "remote", the one true source of truth,
  2. make an "initial commit" using the code from one of your workspaces
  3. gradually add your colleague's changes by overwriting the git repo code with their workspace code. This way you can benefit from the "git diff" feature that will allow you to easily make code merging. In fact, you can go wild and do branching, merging and anything else you can otherwise do in a typical distributed Git repo scenario. The only difference is that it will all happen on a single computer, copying code from others using the USB sticks.
Alin Pandichi
  • 955
  • 5
  • 15
  • So i would copy the other persons work-space, open it in eclipse and synchronize it to the git repository? Also how would i open the two worspaces at once? Would i have to change to the other person's workspace and then commit? – BitShuffler Jan 11 '16 at 15:30
  • Actually, what I had in mind was to do all the merging using command-line git, without using Eclipse plugins for this. I would use Eclipse strictly for code editing. – Alin Pandichi Jan 11 '16 at 16:32
-1

If your computers are not in a network is not possible to use a (non distributed) versioning software (like CVS, Subversion for example).

Instead if your computers are in a network not accessing internet you can run a versioning engine software in a computer of the network and synchronize your code using it.


Having one server for versioning system (also standard, not only distributed), another possibility is to synchronize code manually as following:

  • Create a working directory for each user in the server
  • Copy the code from PC of user 1 to directory of user 1 on the server
  • Synchronize on the server directory of user 1
  • Do the same for all other users

Versioning system should be easy to use. If you need to copy data from an USB card to synchronize your code this is not so easy.

So I suggest to split your code in pieces and assign each piece to a particular person. Work with well defined interfaces so all can work without having the last version of the others code.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56
  • I suppose that with GIT that is a distributed versioning system is possible. With any other non distributed versioning system is not. – Davide Lorenzo MARINO Jan 11 '16 at 15:21
  • I added that detail on my answer. – Davide Lorenzo MARINO Jan 11 '16 at 15:21
  • Interesting idea. But the computers are not in a network. I'll update the question, but all the network infrastructure was removed. If anything we need a way to sync 2 work spaces together between 2 usb's. – BitShuffler Jan 11 '16 at 15:23
  • "If your computers are not in a network is not possible to use a versioning software." - this is wildly incorrect. Nothing prevents you to use Git on a computer that is not connected to the network. Yes, you won't be able to push to and pull from others. But that doesn't mean you cant keep track of your changes locally. – Alin Pandichi Jan 11 '16 at 15:26
  • @Alin Git is a distributed versioning system. It means that you can have your local copy of the versions. It doesn't work for non distributed versioning systems. I already updated the answer (before your comment) to explain that. – Davide Lorenzo MARINO Jan 11 '16 at 15:29
  • In response to your update: how would testing go then? We need to be able to test things as we go along, if we do it that way it would still work but we are bound to the occasional errors, it would be a pain to fix those errors at the end and much easier to be able to test the code and the code's compatibility as we go along. – BitShuffler Jan 11 '16 at 15:39
  • You can test as always. Basically you have a code updated in the personal directory. Simply copy it via usb to the user PC replacing the old code – Davide Lorenzo MARINO Jan 11 '16 at 16:37