llinfeng
llinfeng

Reputation: 1395

How to collaborate with poeple using Dropbox if I prefer to use Git (Github)?

Short question:

At the end of the day, I would like to keep pushing to the remote git-repo as usual. I will push shortly after committing, and would prefer all file-contents from the two sources (the Dropbox folder and the local copy of the Git-repo) to stay synced before and after the commit-push activities. (I am less confident here as this may go against the philosophy of "staging" my works per each commit.)

Clarification: I do not intend to do anything fancy with Git. I prefer to keep working with the same branch, and to pull/push from/to the same Github repo as the remote. In particular, I will need to get things to work on multiple PCs and a Linux machine.

Unsuccessful attempts:

  1. First, I think it is a bad idea to initialize a git-repo inside the ~/Dropbox folder, as it creates clutters and thereby, likely, conflicts.
  2. I have thought about creating a "Selective-sync" through the Dropbox GUI to simply exclude the .git folder. Yet, without such .git folder, it is unclear how to establish the local repo on all computers of mine (I do use multiple Windows PC and one more Linux box).
  3. I am not good at symlink, and have been playing with it a good number of times but failed. If someone were to suggest it, please be precise. Also, I would need it to work across multiple Windows machines and Linux box. I am happy to add more details as long as I get a working demo from you.

Backgrounds

Thankfully, my collaborators has improved from the emailing habit of handing off drafts and work-in-progress through piles of zip-files. Nowadays, they are happy with a shared Dropbox folder. Yet, they haven't started to care too much about version control. Quotes from them: "Git on the command-line? It is a joke?" lol.

On the other hand, I have been happy with pushing to Github as my remote repo, and have been doing so for a good number of years. I am used to my git commands, and have devised the following alias settings to do so quickly.

alias ga='git add -A'
alias gs='git status'
alias gc='git commit -m'
alias gp='git push'
alias gpp='git pull'

I am looking for a way to use Git(Github) and Dropbox in harmony. And I am aware of the following knowledge:

Among the three unsuccessful attempts on my end, I am inclined to believe some symlink command (or complicated scripts) will do the trick. Looking forward to further instruction from the community. I am tagging as many vision control

Upvotes: 1

Views: 376

Answers (1)

llinfeng
llinfeng

Reputation: 1395

Tentative attempt using git-worktree?

Inspired by noamross's post, the following quote looks applicable to my situation

With git worktree, you have one or more “linked working trees” (linked directories) connected to the “main working tree” (main directory). Importantly, linked directories do not have .git folders. Instead, they have .git files which point them to the main directory. This means they are much less trouble to sync with Dropbox.

The steps appear to be super relevant, and I feel like experimenting the following: * Initialize the repo somewhere else; * As suggested in the original post, issue the command git worktree add -b dropbox ~/Dropbox/project-repo-dropbox to create the other branch on Dropbox.

Remaining documentation for the git-worktree method (missing for now)

  1. How to replicate the git worktree setting on another Windows/Linux machine?
  2. Good reference on "branching in Git". I have personally not used branches a lot, and will need to update this post with a complete workflow.
  3. Well, a simple answer whether the proposed recipe works or not. (Didn't have the time to try it out yet.)

Please advise if you have better ideas :)

Upvotes: 1

Related Questions