The git log command reads commits from the repository starting with the newest. When you add formatting options like --pretty=format, git log applies those to each commit's data. For example, %h shows the short commit hash, %an the author name, %ar the relative date, and %s the commit message. Using -3 limits output to the last three commits. The execution table shows each step: reading a commit, formatting it, and displaying it. Variables like commit_count track how many commits have been processed. Git stops reading commits once the limit is reached. This helps you see a clean, customized list of recent commits.