Question: Is there a simple way to export a single file from different git branch (local or remote) without checking out that branch?

Answer: 
You can do the following:

```
 git show experiment:docs/README.txt > /tmp/exported-README.txt

```

... for a local branch `experiment`. For a branch that's in the repository you're referring to with the remote `origin`, you can do the following, similarly:

```
 git fetch origin
 git show origin/other-experiment:docs/README.txt > /tmp/exported-README-remote.txt

```
Yup

```
git show remote/branchname:path/to/file

```

If you want to save it directly, this might come in handy:

```
git_showfile () 
{ 
    if [ $# -lt 1 ]; then
        return 255;
    fi;
    local fspec="$1";
    shift;
    local fname="$(basename "$fspec")";
    local fpath="$(dirname "$fspec")";
    local revision=HEAD;
    if [ $# -ge 1 ]; then
        revision="$1";
    fi;
    if [ -e "$fspec" ]; then
        echo not overwriting existing file;
    else
        mkdir -pv "$fpath" && git show "$revision:$fspec" > "$fspec";
    fi
}

```

**Edit:** ... which you would use as follows

```
git_showfile path/to/file 

```

or

```
git_showfile path/to/file 237f723edcb89

```

etc.