Hello there.
I'm using a bash function that does a combination of 'ls -l', 'git status', and
'git branch'
to give me a quick overview of where I stand in the current git repo.
I planned to extend that function to also list the to-be-pushed commits in the
current branch, something like
$ git log --oneline --abbrev-commit --decorate @{u}..
But I don't want to run that 'git log...' if there's no upstream configured
for HEAD (and I don't want to see any error!)
OK. That's a task for 'git rev-parse' I thought:
$ up=$(git rev-parse --verify --quiet @{u}) &&
git log --left-right --oneline --abbrev-commit --decorate $up
fatal: no upstream configured for branch 'master'
Wait. What?
I thought rev-parse with '--verify' and '--quiet' is just that - quiet -
in case "...the first argument is not a valid object name" ?
Let's see:
$ git rev-parse --verify --quiet master@{xyz} || echo No
No
$ git rev-parse --verify --quiet master@{u} || echo No
fatal: no upstream configured for branch 'master'
No
I don't want to see that error (and I know I could just redirect stdout/stderr
to /dev/null ...)
So: Are my expectations about 'rev-parse --verify --quiet' wrong or am I doing
something stupid ?
Thanks,
Stefan
--
----------------------------------------------------------------
/dev/random says: Disclaimer: Written by a highly caffeinated mammal.
python -c "print
'73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')"
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9 9666 829B 49C5 9221 27AF
N�����r��y����b�X��ǧv�^�){.n�+����ا���ܨ}���Ơz�&j:+v�������zZ+��+zf���h���~����i���z��w���?�����&�)ߢf