0

After dabbling for a few years in coding (and getting hundreds of answers from Stackoverflow), I've decided to commit to a version control system. I am a frequent user of onedrive, and would like to synchronize through that to use multiple machines for development.

After a first failed attempt, I looked up some instructions, and have proceeded as follows:

I set up a bare repository on OneDrive, and cloned that to local repositories on my two main machines. What I would like to do is to be able to make some changes, stash them, drive to work, and access the stashed changes on a different machine. Is this possible, or do I just need to create a branch and commit in order to do this? Or, is there a way to use a OneDrive folder from both machines, and and just see all my work in one place?

Alexander Oh
  • 24,223
  • 14
  • 73
  • 76
kgeil
  • 1
  • 1
  • 1
    at work we have the rule: if you need to stash for more then a minute (this number changes a bit per person/week/topic, but hey), then no, don't use a stash. Stashes for actual content is a recipe for loss of code :) . Use a branch for this. just commit your code. Maybe 'fix' the commits later. – Nanne May 23 '16 at 20:05
  • Using onedrive might lead to problems, see my answer [here](http://stackoverflow.com/a/15947768/1615903) for an example. – 1615903 May 24 '16 at 04:39

2 Answers2

1

Stashed changes are local only, so you wouldn't be able to see them on a different computer.

do I just need to create a branch and commit in order to do this?

Yes. This is consistent with Git Flow, and is a much safer way to work. In general, unless you have a strong reason to stash, adding and committing changes makes for the most reliable way to keep track of changes, even if you feel they aren't complete.

Briana Swift
  • 1,047
  • 8
  • 9
  • Isn't the data for the stashed changes going to be saved in his .git directory, which is on OneDrive? If so, that would mean the changes would be available on any computer that mounts the OneDrive directory. While I would argue it's technically possible, it's not a good idea. – Brandon McKenzie May 23 '16 at 20:06
  • OK, Thanks Everyone, that's about as clear as a set of answers can get. Thanks again, – kgeil May 23 '16 at 20:11
  • @BrandonMcKenzie, I think in this case, as I've made local clones of the shared project (which I understand to be best practice), the stash only sits in the local (cloned) directory. – kgeil May 23 '16 at 20:15
0

Possible? Probably, so long as you can mount OneDrive to a local file system.

A good idea? Not in the least, on two points:

Firstly, stashes are meant for very temporary operations; if you want to keep your changes for any length of time, branches and commits are advised.

Secondly, your use case calls for accessing code from multiple machines, and you are apparently not in a position to host a server, you'd be well advised to use a free git repository service, such as GitHub. Using OneDrive to host a git repo circumvents a lot of git functionality, which puts your code at risk.

Brandon McKenzie
  • 1,655
  • 11
  • 26