Is there something wrong with using git like this?

Here is my situation. I save a set of files on both my laptop and server. I already have synchronization between two locations using rsync. I recently decided that a certain portion of these files should be under source control. I use gitfor this.

So, I have shared/one that I am synchronizing with rsync. Then I have shared/stuff/one that is running git. I will use git from both places in the local repository. I only work with one copy at a time, and I always sync files back and forth.

I am the only person who deals with these files, and these two locations are the only places where these files exist. The only reason I have gitit is because only today I accidentally deleted some code and couldn’t return it.

So my real question is: is rsyncthere anything that breaks git? Or vice versa?

Edit: for the curious, the reason I use rsync for synchronization instead of git is because I already have a great system for keeping public / folder synchronization in place and would like to keep the git repository in it.

+3
source share
3 answers

There is nothing bad.

, git: commit, blobs , git , , , " ". git gc . git .


, , rsync , git . , git repack, , . :

.git/objects/pack-fe017c0e9ea12841cd29458df7bd4421c2b12458.pack, .keep :

touch .git/objects/pack-fe017c0e9ea12841cd29458df7bd4421c2b12458.keep

git gc , . git repack , .

+4

, , .

+3

I do this all the time, but Unison instead of rsync. The difference is that if you accidentally change something on both machines, Unison will detect the problem. Unison even has a built-in rsync algorithm!

+3
source

Source: https://habr.com/ru/post/1720989/


All Articles