Reputation: 1395
Is there tricks from git
, (or command-line/Git-bash
/WSL
_on_Windows), such that I will be hosting the git-repo locally, in wherever I prefer, and have only the real files synced two-ways between the local git-repo and a Dropbox folder?
Even shorter: is there a way to push from a local repo to a Git remote, and have the files stay "two-way-synced" to a Dropbox folder before and after the push?
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.
~/Dropbox
folder, as it creates clutters and thereby, likely, conflicts..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).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.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:
git
occasionally when hosting everything on Dropbox ==> I am not a paid user of Dropbox, and my projects may easily overgrow my limit. 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
Reputation: 1395
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.
git-worktree
method (missing for now)git worktree
setting on another Windows/Linux machine?Upvotes: 1