Log

Contents

Log#

git log is a command that allows you to check some information about:

  • Commits history;

  • Commit HEAD refer to;

  • Which commits brunches refres to.

oneline#

git log --oneline allows you to get information about each commit in just one line, without any extra information.

So the following example shows the difference - git log without --oneline and with it, used for repositories with few commits.

%%bash
mkdir log_examples
cd log_examples
git init &> /dev/null


for i in {1..5}
do
  echo "Line $i" >> file
  git add file
  git commit -m "Line $i added" &> /dev/null
done

echo "=====git log====="
git log
echo
echo "=====git log --oneline====="
git log --oneline

cd ..
rm -r log_examples
=====git log=====
commit 0ce330290ccbf23709c21b9ab2f954735ecd03b3
Author: Fedor Kobak <kobfedsur@gmail.com>
Date:   Sat Sep 9 14:15:46 2023 +0300

    Line 5 added

commit 80e85aa88db21f3f50baf377614b9eb485f258bb
Author: Fedor Kobak <kobfedsur@gmail.com>
Date:   Sat Sep 9 14:15:46 2023 +0300

    Line 4 added

commit 65a9790a5234f3fc4d0f4d954c76b60db30fc8ce
Author: Fedor Kobak <kobfedsur@gmail.com>
Date:   Sat Sep 9 14:15:46 2023 +0300

    Line 3 added

commit 4df96a83e43be23415c0b0023d10b2e0282188ff
Author: Fedor Kobak <kobfedsur@gmail.com>
Date:   Sat Sep 9 14:15:46 2023 +0300

    Line 2 added

commit 7bdb94f91398e7cd4bcb431dc4a98557629ad202
Author: Fedor Kobak <kobfedsur@gmail.com>
Date:   Sat Sep 9 14:15:46 2023 +0300

    Line 1 added

=====git log --oneline=====
0ce3302 Line 5 added
80e85aa Line 4 added
65a9790 Line 3 added
4df96a8 Line 2 added
7bdb94f Line 1 added