Suppose, I have a centralized git repo at github/bitbucket, and I code either on my laptop or my workstation at the university. What is the most effortless way to sync my current working copy of the code on both of these machines so that I always have the option of picking up where I left off?
I've read the other threads on SO, and they mostly involve commiting to a new branch and pulling/using a usb key/dropbox. But since dropbox might corrupt the git repo, Is there a method, which will allow me to always seamlessly resume where I left off?(Both machines have internet access).
Here are the options I can think of, feel free to add more.
Have a work-in-progress branch on the centralized repo and rebase whenever you want to merge.
Pros:
- Git
Most conflicts will be taken care of by git automatically.
Cons:
- Not automatic. You could forget to do it some days, and be unable to access your latest changes
- If many developers follow this practise, the branch list will be too cluttered.
For each project, have a private repo to sync the work-in-progress branch. Maybe set up vim hooks to automatically commit to that branch
Pros:
- Git
- No clutter in public repo
- Can setup automatic commiting&pushing on each save since it is private and no one sees it.
Cons:
- You will end up with one private repo for each project. (Might not be a problem if you have your own git hosting)
- If you don't have internet and edit a file, dropbox will create two copies and you will have to manually resolve the conflicts
Create a bundle for each project, sync bundle folder using dropbox
Pros:
- Can setup auto commiting wip branch, dropbox syncs bundle folder.
Cons:
- If you don't have internet and edit a file, push to the bundle, dropbox will create two copies of the bundle and you will have to manually resolve the conflicts
Store project folder on Dropbox
Pros:
- In the best case it is truly seamless.
- As long as you have internet, you can start editing your code in the same state you left it in.
Cons:
- Dropbox might corrupt the git database.
- If you don't have internet and edit a file, dropbox will create two copies and you will have to manually resolve the conflicts
Find a way to store multiple repos in a single private repo on bitbucket and have a setup similar to option 2.
I think this might be the best solution, does anyone have suggestions on how I do this?