How do I check if a file exists in a remote?
问题 Is there a way to check if a file under specified, relative path exist in a remote? I'm fine with fetching the info first if it's the only option. In other words I'm looking for git-ls-files with an option to specify remote and branch. I'm only interested if the file exists (a list of files on the branch will do as well), I don't care about hashes, diffs etc. 回答1: You can use git cat-file -e <remote>:<filename> which will exit with zero when the file exists. Instead of <remote> above you'd