There are many ways.
You can use history expansion in (t)csh, bash or zsh. `!$` expands to the last argument of the previous command line.
git checkout --theirs !$ && git add !$
Bash, ksh and zsh have a variable `$_` which stores the last argument of the last simple command executed by the shell.
git checkout --theirs "$_" && git add "$_"
Bash and zsh have a keyboard shortcut `Alt`+`.` or `ESC` `.` which inserts the last argument of the previous command line.
git checkout --theirs Alt+. && git add Alt+.
You can stuff this in a function.
git_add_theirs () {
if [ "$#" -eq 0 ]; then set -- "$_"; fi
git checkout --theirs -- "$@" && git add -- "$@"
}
Or make that a standalone script and define an alias `add-theirs = git_add_theirs` in your `~/.gitconfig`.