On a git conflict, I can currently do:
git diff path/to/some/file.txt
... after reviewing the diff, usually I want to do:
git checkout --theirs path/to/some/file.txt && git add path/to/some/file.txt
It's painstaking to edit both paths each time, so I'd like to be able to do the following:
git checkout --theirs <ref> && git add path/to/some/file.txt
Where the <ref>
refers to file.txt.
Any way to do this in bash?
f='path/to/some/file.txt'; git checkout --theirs "$f" && git add "$f"
– Costas Feb 11 '15 at 12:57git checkout --theirs path/to/some/file.txt && git add !#:3
(repeat the third [zero-indexed] word:3
from the current command line#
) – steeldriver Feb 11 '15 at 13:19git diff path/to/some/file.txt
you could just typegit checkout --theirs
hit Alt+. then type&& git add
and hit Alt+. again. – don_crissti Feb 11 '15 at 13:38bash
,ksh93
, andzsh
put the same info in$_
. – mikeserv Feb 11 '15 at 15:14