Is my commit in the release branch?
Today I stumbled upon having to know if a specific commit was present or not in the release branch. I of course checked stackoverflow, i didn’t have it right in my mind.
VERSION=2.4
COMMIT_HASH=123acaef123acaed
git log origin/release/$(VERSION) | grep $(COMMIT_HASH) | wc -l
git log
- that’s I assume it is ok, just checking theorigin
branchgrep
- also I think that’s ok, just finding the commit hash from the git log listwc -l
- stands for word count and is a command-line utility that counts the number of lines, words, characters, and bytes in a file. and-l
flag tells wc to count only the number of lines.
and there you go! You have effortlessly checked if your commit was present in a specific remote branch