My Attempt of a Potentially New TODO Workflow: How to sync Mobile Phone with My Computer.
Table of Contents
Basic idea: I use my computer for most of the TODO plans, but make sure this changes can be obtained and edited by my phone. Besides, I need to ensure such a communication is free and has no extra requirements of OS, and so on.
Solution: I use termux
to manage my doc communication from my phone to the computer,
and use git
and corresponding hubs to play the role of "bridge".
1. Configuration of My Phone
1.1. Configuration of termux
1.1.1. Basic git
configuration in termux:
pkg update -y && pkg upgrade -y pkg install termux-api pkg install git cronie openssh -y crond git config --global user.name "liangzid" git config --global user.email "2273067585@qq.com" ssh-keygen -t ed25519 -C "GitHub Key" echo "--------------------------Key----------------------------------" cat ~/.ssh/id_ed25519.pub
1.1.2. Config My TODOs
Download it:
git clone git@github.com:liangzid/orgtodo.git ~/orgtodo
cd ~/orgtodo
Configuration the automatic shell script (~/sync_orgtodo.sh
):
#!/bin/bash cd ~/orgtodo || exit 1 git add -A if git diff-index --quiet HEAD --; then echo "No Changes. Do not require to Upload." else git commit -m "AutoCommit By TERMUX: $(date +'%Y-%m-%d %H:%M:%S')" fi git pull --no-rebase || { # 4. if pull conflict found,prefer the local version echo "Conflict Found. We use the local version." git checkout --ours . git add -A git commit -m "AutoMerge: Keep the mobile version. $(date +'%Y-%m-%d %H:%M:%S')" } git push origin master echo "[$(date)] Git sync executed." >> ~/cron.log termux-notification --title "OrgTODO Sync" --content "All Sync Done :)" --icon "check_circle"
Change mod:
chmod +x ~/sync_orgtodo.sh
1.1.3. Config Cron in the Termux
crontab -e
add the following line:
*/60 * * * * /data/data/com.termux/files/home/sync_orgtodo.sh