Is there a standard way for synchronizing git workspace with another directory. Suppose I have a directory that is under git version control. That directory is taken offsite and changes and done to it (files are changed, added and deleted). Then it is returned to my machine. How can I easily integrate all of these changes back into git.
If I were just to copy files over then new and changed files would be fine but information about removed files will be lost. Is there any way to easily do git rm on files that were removed while directory was outside of git?
VonC's answer looks like the 1st part of what you want.
The --work-tree
option is described on the git(1) Manual Page
However after running git --work-tree=/path/to/your/other/directory add -A .
your index is different from your local (original) directory. To make the local directory match the index (that contains all the changes from the offline directory) run git checkout .
.
git --work-tree=/path/to/your/other/directory add -A .
git checkout .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With