simpler setup instructions
This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
parent
d3d6a45918
commit
48c2a95efb
1 changed files with 33 additions and 48 deletions
|
@ -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
|
If you wanted to import everything, you could instead use
|
||||||
"androiddirectory=/sdcard".
|
"androiddirectory=/sdcard".
|
||||||
|
|
||||||
## initial import
|
Next, configure how file trees imported from it will be merged into your
|
||||||
|
git repository.
|
||||||
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.
|
|
||||||
|
|
||||||
git config remote.android.annex-tracking-branch master:android
|
git config remote.android.annex-tracking-branch master:android
|
||||||
|
|
||||||
That configures git-annex to know that you want sync up the master
|
Setting "master:android" makes the phone be treated as containing a branch
|
||||||
branch (specifically the android subdirectory) and your Android device.
|
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:
|
## syncing with it
|
||||||
|
|
||||||
git annex sync --content
|
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
|
## sample workflows
|
||||||
|
|
||||||
|
@ -87,24 +71,25 @@ Android device:
|
||||||
Set up the remote to use the /sdcard/Music directory:
|
Set up the remote to use the /sdcard/Music directory:
|
||||||
|
|
||||||
initremote android type=adb androiddirectory=/sdcard/Music encryption=none exporttree=yes importtree=yes
|
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 annex sync --content 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
|
|
||||||
|
|
||||||
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
|
to over to the Android device, by first copying them to the Android
|
||||||
directory of your git-annex repo:
|
directory of your git-annex repo:
|
||||||
|
|
||||||
cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/
|
cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/
|
||||||
git annex add 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,
|
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
|
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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue