Re: git show doesn't work on file names with square brackets
From: Kirill Likhodedov <hidden>
Date: 2016-06-15 23:08:08
Hi Johannes, thanks for your answer, but unfortunately it doesn’t help.
On 06 Feb 2016, at 17:21 , Johannes Schindelin [off-list ref] wrote: This is expected behavior of the Bash you are using. The commands that I think would reflect your intentions would be: git init brackets cd brackets echo 'asd' > 'bra[ckets].txt' git add 'bra[ckets].txt' git commit -m initial git show 'HEAD:bra[ckets].txt’
Nope. This command sequence doesn’t work for me: the same error is returned:
# git show 'HEAD:bra[ckets].txt'
fatal: ambiguous argument 'HEAD:bra[ckets].txt': both revision and filename
You could also escape the brackets with a backslash, as you did, but you would have to do it *every* time you write the path, not just in the `git add` incantation.
As I mentioned at the end of my original message, escaping doesn't help either. `git add` works fine both with and without escape. It was auto-completed by bash completion, and I just forgot to remove the backslashes before pasting the code here. At any case, escaping doesn’t work with `git show`.