I'll expand a bit on my comment on LeGEC's answer here.
Suppose you have a repository:
$ cd <somewhere-with-repository>
and that repository has a remote name, e.g., origin, and the remote has some branch(es). We now do your git status --porcelain=v2 to get an example output:
$ git status --porcelain=v2 -b
# branch.oid 2808ac68000c62c3db379d73e3b7df292e333a57
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
This particular repository has only master and origin/master:
$ git branch -a
* master
remotes/origin/master
so now we need to create a new branch to trigger your desired condition:
$ git switch -c foo
Switched to a new branch 'foo'
$ git status --porcelain=v2 -b
# branch.oid 2808ac68000c62c3db379d73e3b7df292e333a57
# branch.head foo
We now need to set the upstream to origin/foo, but git branch -u refuses to do it:
$ git branch -u origin/foo
error: the requested upstream branch 'origin/foo' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
But we can work around that using the underlying branch.foo.remote and branch.foo.merge settings:
$ git config branch.foo.remote origin
$ git config branch.foo.merge refs/heads/foo
# branch.oid 2808ac68000c62c3db379d73e3b7df292e333a57
# branch.head foo
# branch.upstream origin/foo
Using git branch -vv shows us this:
$ git branch -vv
* foo 2808ac6 [origin/foo: gone] add xheap, for a priority queue for py3k
master 2808ac6 [origin/master] add xheap, for a priority queue for py3k
This is what we'd see as well with git push -u origin foo followed by a deletion of origin/foo that prunes our own refs/remotes/origin/foo.
(It's a bit curious that git branch -u won't let you set up this situation directly, since it would obviate the need for git push -u later and hence be useful in scripts. But the lower-level git config commands do let you set up this situation.)