I'm reading through an old deployment script and I came across a line of bash that puzzles me.
The statement is as follows.
if [[ \\$(git log @{u}.. 2> /dev/null | tail -n1) != '' ]];
then echo 'LOCAL BRANCH HAS UNCOMMITTED CHANGES.';
fi;
As far as I can tell, we're running a git log and checking to see if the output was an empty string. I could be very off, but this is why I'm asking.
git log @{u}.. 2> /dev/null | tail -n1
The above is what is the confusing part. If I run this on a local repo I get an empty string as a return value. I don't understand why though. I don't understand what the @{u}.. 2> /dev/null
means. From what I understand the 2> /dev/null
is redirecting the possible error into a file located at /dev/null
. But what is the rest of this line doing? ie the @{u}