Peace between git and Dropbox with git-worktree

Further refinements on this front: I use Dropbox Selective Sync (SS) to prevent the .git file from being shared. I alluded to this above, but here are all the steps now that I’ve done this a few times:

  • In project-repo-dropbox, temporarily rename .git to something like .git2
  • Then create a directory with mkdir .git
  • Go to Dropbox UI on your client and under Preferences > Account > Selective Sync, navigate to project-repo-dropbox and unselect the .git folder. This will remove the .git folder from the directory on your computer.
  • Go back to project-repo-dropbox in the command line and rename .git2 to .git
  • In the Dropbox web interface, navigate to project-repo-dropbox and delete the .git folder there.

Yes, this is a lot of hoops to jump through, but basically none of it is visible/relevant to your dropbox collaborators.

Other git users can now do the same thing and have whatever folder structure they want without everyone’s .git files borking each other.

If multiple dropbox users are using RStudio, though you may want to advise them to use Selective Sync on the .Rproj.user directory (as suggested in the RStudio docs).

(Interestingly RStudio Server Pro, which has shared project support, splits up the .Rproj.user stuff into separate user folders to prevent conflicts and allow the users to each save different IDE states.)