On Sun, Dec 04, 2022 at 02:32:01PM +0100, rozanski.s...@gmail.com wrote: > How would it be possible to automatically move all changes in the project > (repository) => I mean the situation when I change/add/delete a file or > directory in the project not yet perform a commit => automatically on the > mirrored directory that is on OneDrive, this would be some "workaround" for > the problem.
Yes, it should be possible. Fitst, you should get terminology right: "the repository" is that subdirectory called ".git" which is located in the directory Git calls "the work tree". So, when you have a filesystem hierarchy like this \MyProject \.git \folder1 \folder2 file1.php file2.php ...and you're operating on folder1, folder2, file1.php and file2.php, because these files are "checked out", then Git says these files are located in a work tree, and ".git" contains the project's repository. In other words: \MyProject <- your project's tree root; also the Git's work tree. \.git <- the Git repository. \folder1 \folder2 file1.php file2.php So, to achieve what you want - automatically sync to the cloud all the local changes you do to the checked out files but not to the repository itself, - there appears to be two ways: - Somehow explicitly tell OneDrive to exclude that particular ".git" directory from its operation, recursively. - Keep the Git repository outside of the directory which is under the control of OneDrive. The former appears to be hard, if at all possible [1]. The latter is quite doable with some tinkering. Basically you roll like this: 1. Clone your existing repository from your Git hosting provider (Bitbucket?) in "mirror" mode. With "normal" Git this is done using git clone --mirror REPO_URL REPO_DIR The REPO_DIR directory must not be located in a directory which is under control of OneDrive. I have no idea how to do mirror-cloning using that Bitbucket or SourceTree apps. Also note that you must not clone a Git repository located on a filesystem: while it's trivially possible in Git, the resulting repository won't be configured properly. 2. Create an empty directory in any directory which _is_ under control of OneDrive. 3. Open up a text editor and create a single file named ".git" in that new directory and make it contain a single line of text: gitdir: C:\Path\To\The\REPO_DIR\Created\On\Step\One That is, a prefix "gitdir:", a single space character, and the path to the repository. Note that the file must not have any extension such as ".txt". It's name must be exactly ".git": a dot and three lowercase characters. 4. Open up a shell, navigate to that directory prepared on steps 2 and 3 and run git init 5. Check that everything looks normal: run `git branch` for instance. If this does not work, try to use a Unixy-looking path in that text file: gitdir: /c/Path/To/... That is all: you can now use the new directory in the OveDrive-controlled directory while the repository is located elsewhere. 1. https://superuser.com/questions/1662589 -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20221204141608.fqkmzwihbgvjlmr3%40carbon.