javier_domenech
javier_domenech

Reputation: 6263

git show last commits pushed

I'm updating my trello with the last commits pushed on the CI/CD pipeline. For the moment I'm using:

git log --format='- %B' --no-merges HEAD^..HEAD

But it's getting the last commit while I'd like to get a list of all the commits made since the last push.

Upvotes: 1

Views: 144

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 22057

So you'd have to change the reference against which you're comparing the present code.

Your range HEAD^..HEAD is a verbose way to designate HEAD which.... doesn't even need to be designated because it is implied when no ref is explicitly given.

So your command is equivalent to

git log --format='- %B' --no-merges --no-walk

But now for the need to compare against last pushed state : you'd have to use the remote state of the same branch.

Let's assume your branch is called feature-1 and your remote origin :

# First let's make sure the remote ref is up-to-date
git fetch

# then the logging itself
git log --format='- %B' --no-merges origin/feature-1..feature-1

Upvotes: 1

Related Questions