Here’s something I wrote a long time ago and still find useful from time to time: a tool to check whether a specific github.com/flutter/flutter commit has been merged into one of the branches.
Let’s say a fix you care about has just been approved and merged into main. Unless you’re on the bleeding edge, you probably need to wait until it’s in stable or beta. But how do you check this quickly?
AFAIK, the easiest way is by using the shell script below, which I wrote some very long time ago (the year was 2018!).
Usage:
- Find the PR you’re interested in
- Find the note that says
Merged via the queue into flutter:master with commit ??????? - Copy the commit number
- Run the script:
$ ./are_we_there_yet.sh 8eab409
This will list all the important branches the commit has been merged into so far.
Output for a commit that just landed in main:
Searching for commit 8eab409.
Commit is merged into:
upstream/main
Output for a commit that’s already all the way in stable:
Commit is merged into:
upstream/main
upstream/beta
upstream/stable
Source code
Here’s the complete source code:
#!/usr/bin/env bash
set -o vi
# Change this accordingly.
# You may have github.com/flutter/flutter named as "origin", "upstream", or any other string.
REMOTE_NAME=upstream
# The hash we search for when no argument is given.
DEFAULT_HASH=76468dd
if [ -z "$1" ]
then
echo "You can provide the commit hash you're interested in as argument."
echo "Defaulting to $DEFAULT_HASH."
HASH=$DEFAULT_HASH
else
HASH=$1
echo "Searching for commit $HASH."
fi
FLUTTER_TOOL_PATH=`which flutter`
DIR=`dirname $FLUTTER_TOOL_PATH`/..
# Overriding the heuristic above.
DIR="/Users/filiph/dev/flutter"
cd $DIR
# echo $DIR
git fetch $REMOTE_NAME # > /dev/null
echo "Commit is merged into:"
git branch -r $REMOTE_NAME/main --contains $HASH
git branch -r $REMOTE_NAME/beta --contains $HASH
git branch -r $REMOTE_NAME/stable --contains $HASH
This has only been tested on my own devices but it’s so simple it should work in any POSIX shell. You need git installed but nothing else. Obviously, I share this you “AS IS”, no guarantees and no liability implied. Consider it public domain.
