Reputation: 1134
I already know how to get a list of commits since the last tag.
git log <yourlasttag>..HEAD --oneline
which outputs something like this, assuming we tagged before the BUGFIX commit:
j87jbhg FEATURE: Allow users to add jam or jelly to toast
dkdj8da FEATURE: Allow users to butter toast
d8d87a7 BUGFIX: Toast was burnt
However, we routinely squash commits for topic branches using interactive rebase (git rebase -i HEAD~5, for example), and then either merge that branch into our production branch, or cherry-pick it over.
An unfortunate side effect of the interactive rebase is, if you squash commits into the first commit (squashing HEAD~1, HEAD~2, HEAD~3, HEAD~4, into HEAD~5), your new commit has a date of when HEAD~5 was first committed. This has always bothered me, but has never been a problem (outside of hunting for commits in git log, or on github). Until now.
We tag every production deploy, so we'd like that the output of git log <yourlasttag>..HEAD
(or some other command) to include all commits which haven't been deployed to production.
So, if our history looks more like this:
j87jbhg FEATURE: Allow users to add jam or jelly to toast
dkdj8da FEATURE: Allow users to butter toast
d8d87a7 BUGFIX: Toast was burnt
2222222 (tag: 2016.02.01) FEATURE: Allow users to make toast
1111111 FEATURE: Allow users to make orange juice
0000000 (tag: 2016.01.15) FEATURE: Toaster model
Commit 1111111 (orange juice) hasn't actually deployed to production; it was the result of an interactive rebase, with commit HEAD~5 (from above) originally being committed before commit 2222222 was tagged and pushed to production.
Therefore, when we push to production, the new commits are ALL the features and bugfixes listed above, as we'd expect (including 1111111). But, git log 2016.02.01..HEAD --oneline
still just outputs:
j87jbhg FEATURE: Allow users to add jam or jelly to toast
dkdj8da FEATURE: Allow users to butter toast
d8d87a7 BUGFIX: Toast was burnt
Which makes total sense. Except, it's not what I want.
What are my options for getting a list of the commits I'm looking for, using the command line (not gitk) and hopefully flags (instead of changing my git commit)?
Related: Does anyone know how to change the date of that squashed to the time of the interactive rebase?
Upvotes: 0
Views: 1108
Reputation: 1134
I was asking the wrong question!
git log origin/production..HEAD --oneline
per Viewing Unpushed Git Commits
This lists all the commits not yet pushed to production.
Upvotes: 2