#!/bin/bash
set -e
if [ -z "$1" ]
then
    echo "Usage: gct FILE"
    exit 1
fi
set -x
for file in "$@"
do
    OWNER=$(stat -c "%u:%g" "$file")
    git checkout --theirs "$file"
    chown "$OWNER" "$file"
    git add "$file"
done
