I am trying to customize the format for git log
. I want all commits to be shown in one line. Each line should only show the first line of the commit message.
I
Have you tried this?
git log --pretty=oneline --abbrev-commit
The problem is probably that you are missing an empty line after the first line. The command above usually works for me, but I just tested on a commit without empty second line. I got the same result as you: the whole message on one line.
Empty second line is a standard in git commit messages. The behaviour you see was probably implemented on purpose.
The first line of a commit message is meant to be a short description. If you cannot make it in a single line you can use several, but git considers everything before the first empty line to be the "short description". oneline
prints the whole short description, so all your 3 rows.
Does git log --oneline
do what you want?
git log --format="%H" -n 1
Use the above command to get the commitid, hope this helps.