0

I made several commits to a branch then merged it (no-ff) to master and deleted the local and remote branches.

I subsequently want to see what commits made up the feature.

However, instead of my log looking nice like this nice git log

It looks more like this because the team don't rebase their branches before accepting pull requests on GitHub spaghetti commit log

The first picture shows the 3 commits that made up the feature but the second requires me to scroll a long way down keeping track of moving lines looking for the commits.

Is there any way of filtering out the feature from the second log so it looks more like the first?

opticyclic
  • 7,412
  • 12
  • 81
  • 155

1 Answers1

0

I subsequently want to see what commits made up the feature.

Few options:


git log

You can checkout the master again and then compare it with your branch

git log ^master oauth-signin
git log master ^oauth-signin

# add any more flag you like
git log --decorate --graph --oneline --all

# Display the difference between range of commits (in this case HEAD and its parent)
git log HEAD^..HEAD --oneline --stat --graph --decorate

git merge-base

It will show you what is the difference between the branches using merge-base.

git merge-base finds best common ancestor(s) between two commits to use in a three-way merge.

One common ancestor is better than another common ancestor if the latter is an ancestor of the former. A common ancestor that does not have any better common ancestor is a best common ancestor, i.e. a merge base. Note that there can be more than one merge base for a pair of commits.


Other options:

git diff HEAD...<SHA-1>
git show HEAD...<SHA-1>

# on git version > 2.6
git log --cc
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • As mentioned in the question, the branches have been deleted. I am looking at the history of master only. How does this help? – opticyclic Mar 21 '16 at 09:09
  • You can always check them out again and then compare the content. Here is how to do it? http://stackoverflow.com/questions/34519665/how-to-move-head-back-to-a-previous-location/34519716#34519716 – CodeWizard Mar 21 '16 at 09:13