7

I have been learning a lot about the git log lately and would like to write it to a file so I can process it and write a changelog/release notes from it. However, when I write the git log between two commits or two tags I lose a lot of the commits in between. I'm not sure why this is. I checked the GitHub network graph and checked the commit history on GitHub manually and the commits that I lose are commits belonging to the branch, so I am thinking that my commands are wrong or incomplete.

Here is what I have done and tried

  • in git bash, navigate to the directory where the respective .git folder is
  • check out the respective branch (dev in my case)
  • see the full history, no merge commits (written to file)
    $ git log --pretty=oneline --no-merges --decorate=short > file1.txt
    This gives me what I need in terms of amount of information; the output looks like this (please ignore the commit messages themselves...):

a384d44ff80de33aebd9057f3c99e822440fa545 Adjusted dev version (#13)
6ddf190dd11bcc71552b482b4751acc7c98a74d2 (tag: 0.0.1) 0.0.1
f7fb130f7b3f48d5fc0b2edde2bb888a891c76a6 Back to 0.1.1
881e70c8df9a3df6ec8ee8cba13b39165e9db179 Update DESCRIPTION version
d3dc1169705c5f48748bcd72d07ebd2bf5eff59f Update DESCRIPTION version
b766875b4fcaa978f6ec85129a2542ed5dd44762 Update description file version number to match version tag
ed04156444914785b002b5c94b501ed54b5b99a4 (origin/vd-networkPl) Debugging to fix issue with igraph graph_from_data_frame()
dd96aca4db22d5b9921726795642a2358248526d Write network plot vignettes
64d216700a9df8393eeab0b2c6967554da18a092 Update codex to work with network plot

  • Then I try to narrow it down, so only write the history between two commits or two tags
    git log --pretty=oneline --no-merges --decorate=short commit1..commit2> file2.txt
    or
    git log --pretty=oneline --no-merges --decorate=short 0.0.0..0.0.1> file3.txt
    In both cases, I loose hundreds of commit messages. Instead of having a file with hundreds of lines, I get 24. I know that I don't have hundreds of merge commits, so what am I missing here?

Sorry I didn't add a reproducible example. All my repositories are private (company regulations) so I wasn't sure how to create a reproducible example.

damico
  • 195
  • 1
  • 7
  • Does this answer your question? [List commits between 2 commit hashes in git](https://stackoverflow.com/questions/18679870/list-commits-between-2-commit-hashes-in-git) – underscore_d Jan 25 '21 at 16:02
  • I'm not sure I understand it fully or would know how to make use of it for my case. I understand it's about seeing more commits than expected and about non-linear history, but how do I apply it to my case where I see less commits than expected? – damico Jan 26 '21 at 08:26
  • Others who just find the title of this question might want to try the `--follow´ (for single file) or the `--full-history` (all files) option. – donquixote Oct 25 '22 at 10:08

2 Answers2

10

Try --all option

git log --all
Dev Matee
  • 5,525
  • 2
  • 27
  • 33
  • This sort of worked in that it would show all the commits and exclude the merge commits, but I cannot narrow it down to commits between tags/commits. `$ git log --all --no-merges --pretty=oneline --decorate=short 8a8583f0fcb4d3e98f3a0efeaef1ad83f163cf9c..6ddf190dd11bcc71552b482b4751acc7c98a74d2 > file.txt` - this didn't write the start commit to the file but then it wrote everything and did not end at the end commit. – damico Jan 26 '21 at 08:16
0

you enter git log --all in your command-line interface and hit enter, you'll see a list of commits from all branches in reverse chronological order, just like with the git log command.