Vini.g.fer
Vini.g.fer

Reputation: 11909

Git: get changes with single command

Everytime we deploy code, I need to get the new commits on stage, that are not in master. I use the following commands to achieve that:

git merge-base dev master

which returns me a commit hash were both branches "split", and then I input that hash into this command:

git log commit_hash..HEAD --pretty=oneline --format="%s" | grep -v "Merge pull request"

I tried to join both commands, but without success. Is there anyway to achieve that with a single git (or bash) command?

Thanks!

Upvotes: 1

Views: 44

Answers (2)

Romain Valeri
Romain Valeri

Reputation: 21908

What about just nesting instructions with the $() bash construct?

git log $(git merge-base dev master)..HEAD --pretty=oneline --format="%s" | grep -v "Merge pull request"

It's a single line, but would it fit your definition of "in a single command"?

Upvotes: 2

Marek R
Marek R

Reputation: 37512

Try this (note tree dots):

git log --right-only master...HEAD --pretty=oneline --format="%s" --no-merges 

See git log documentation for:

  • --right-only
  • --no-merges

Upvotes: 2

Related Questions