#!/bin/s
# Git-Annex Tutorial

# On the laptop
cd wallpapers
git init
git annex init
git annex add . # by default files are moved into .git/annex and replaced by symlinks
git commit -am 'add files'
git annex unlock .  # replace symlinks with 2nd copy of files
git annex lock . # replace files with symlinks again

# On the pretend server
cd ..
mkdir wallpapers-bare
cd wallpapers bare
git init --bare

# On the laptop
cd wallpapers
git remote add server-bare ../wallpapers-bare
git annex sync

# On the pretend server
cd ..
git clone wallpapers-bare wallpapers-server
cd wallpapers-server
git annex init

# On the laptop
cd wallpapers
git remote remove server-bare
git remote add server ../wallpapers-server
git annex sync # git push server master will also work 
git annex copy -t server *.webp # copy webp files to the server
git annex drop *.webp # this will remove all webp files from .git/annex
git annex drop *.jpg # this will fail as jpg files have not been copied
git annex get . # copy back the deleted files

git clone wallpapers-server wallpapers-flash-drive  # create a copy on the same machine, such as a flash drive
cd wallapers-flash-drive
git annex init
git remote add laptop ../wallpapers
cd ../wallpapers
git remote add flash-drive ../wallpapers-flash-drive
git annex sync
cd ../wallpapers-flash-drive
git annex get . # copy all files from the original repo



