Skip to content
Justice Tech School

Listing and Comparing Branches

git branch -v shows last commits, --merged lists merged branches and git log a..b shows commits in b not in a.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git switch -q -c feat
echo f > f.txt && git add f.txt && git commit -qm 'feat work'
git switch -q main
git branch --merged | tr -d ' *'
git log main..feat --format=%s

Result

main
feat work

Exercise

Merged branches.

git branch 

Quiz Test

What does main..feat show?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.