simpler setup instructions

This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
Joey Hess 2019-04-10 12:34:28 -04:00
parent d3d6a45918
commit 48c2a95efb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -26,48 +26,32 @@ Android device, so it will only import photos and videos, not other files.
If you wanted to import everything, you could instead use
"androiddirectory=/sdcard".
## initial import
Now you can import all files from your Android device:
git annex import master:android --from android
git merge --allow-unrelated-histories android/master
That merges the imported files into the existing contents of your git-annex
repository. In the example above, the imported files were put into an
"android" subdirectory, to keep them separate from your other files.
If you leave off the ":android", the files will be imported into the top of
the repository.
## initial export
With the files from the Android device imported, you might want to remove
them from it, to free up space on it. Or, you might add more files that you
want to export to it, or change files. Whatever changes you make,
you can `git annex add` and `git commit` as usual. Then to export
the changed branch to the Android device:
git annex export master:android --to android
(Again the ":android" limits it to the android directory,
so leave thatoff if you want to export everything.)
It's fine to export and import in any order and at any time, and you can
make changes to files on the Android device at any time too. git-annex will
keep it all in sync.
## automation
Let's automate that syncing process some more.
Next, configure how file trees imported from it will be merged into your
git repository.
git config remote.android.annex-tracking-branch master:android
That configures git-annex to know that you want sync up the master
branch (specifically the android subdirectory) and your Android device.
Setting "master:android" makes the phone be treated as containing a branch
of the master branch, and makes all its files appear to be inside a
subdirectory named `android`. If you want its files to not be in a
subdirectory, set it to "master" instead.
Now, you only have to run a single command to sync everything:
git annex sync --content
## syncing with it
git annex sync --content android
This command does a bi-directional sync with the phone, first importing
new and changed files from it, merging that into the master branch,
and then exporting from the master branch back to the android device so any
modifications you have made get synced over to it.
See [[git-annex-import, [[git-annex-export]], and [[git-annex-sync]]
for more details, and bear in mind that you can also use commands like
these to only import from or export to the android device:
git annex import master:android --from android
git merge android/master
git annex export master:android --to android
## sample workflows
@ -87,24 +71,25 @@ Android device:
Set up the remote to use the /sdcard/Music directory:
initremote android type=adb androiddirectory=/sdcard/Music encryption=none exporttree=yes importtree=yes
The annex-tracking-branch can be the same as before, to limit
the files that are synced to those in an android directory:
git config remote.android.annex-tracking-branch master:android
The rest of the commands are unchanged:
And then do an initial sync:
git annex import master:android --from android
git merge --allow-unrelated-histories android/master
git annex export master:android --to android
git config remote.android.annex-tracking-branch master:android
git annex sync --content
git annex sync --content android
With this setup, you can copy music and podcasts you want to listen
Now, you can copy music and podcasts you want to listen
to over to the Android device, by first copying them to the Android
directory of your git-annex repo:
cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/
git annex add android
git annex sync --content
git annex sync --content android
Once you're done with listening to something on the Android device,
you can simply delete on the device, and the next time git-annex syncs, it
will get removed from the android directory.
will get removed from the android directory. Or, you can delete it from the
android directory and the next sync will delete it from the Android device.