35 lines
625 B
Bash
Executable file
35 lines
625 B
Bash
Executable file
#!/bin/zsh
|
|
|
|
histdb="$1"
|
|
shift
|
|
|
|
if [[ -d "$histdb" ]]; then
|
|
pushd -q "$histdb"
|
|
|
|
git add zsh-history-*.log
|
|
git commit --all --message "$(hostname): update history"
|
|
|
|
git pull --no-edit --no-rebase
|
|
|
|
for f in ./zsh-history-*.log; do
|
|
tmpfile=$(mktemp)
|
|
exec 3>"$tmpfile"
|
|
exec 4<"$tmpfile"
|
|
rm "$tmpfile"
|
|
|
|
grep --invert-match "^[<,>,=]\{5,\}" $f >&3
|
|
<&4 tee $f
|
|
|
|
sort --output="$f" "$f"
|
|
|
|
git add $f
|
|
git commit -m "$(hostname): resolve merge ${f}"
|
|
done
|
|
|
|
git push
|
|
|
|
popd -q
|
|
else
|
|
echo "\$histdb does not exist at: \"$histdb\" "
|
|
fi
|