DEV Community

rndmh3ro
rndmh3ro

Posted on • Originally published at zufallsheld.de on

TIL how to view the history of a file with git

When reading the title you may think: “d’oh! that’s easy, with git log, of course!” And of course it’s done with git log. But what I didn’t know is that with git log -p path/to/file you can show the history of a file including its changes:

> git log -p molecule/mysql_hardening/molecule.yml
commit 47c771cc628c4a570552c4b76cba22a5aaa92660
Author: Martin Schurz <Martin.Schurz@t-systems.com>
Date: Fri Feb 24 01:07:41 2023 +0100

    add idempotency check

    Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

diff --git a/molecule/mysql_hardening/molecule.yml b/molecule/mysql_hardening/molecule.yml
index a9c5a0b..0eef4be 100644
--- a/molecule/mysql_hardening/molecule.yml
+++ b/molecule/mysql_hardening/molecule.yml
@@ -53,6 +53,6 @@ scenario:
     - create
     - prepare
     - converge
- # - idempotence # not idempotent
+ - idempotence
     - verify
     - destroy

commit c2e9c9a8dd81d2758a94ba1509a18dd9d2b5654e
Author: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Date: Mon Feb 6 14:01:40 2023 +0100

    try to fix molecule local tests (#632)

    these settings are probably not necessary (geerlingguys images dont have them either)

    Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

diff --git a/molecule/mysql_hardening/molecule.yml b/molecule/mysql_hardening/molecule.yml
index bbbfe30..a9c5a0b 100644
--- a/molecule/mysql_hardening/molecule.yml
+++ b/molecule/mysql_hardening/molecule.yml
@@ -15,15 +15,6 @@ platforms:
     privileged: true
     cgroupns_mode: host
     pre_build_image: true
- environment:
- container: docker
- security_opts:
- - apparmor=unconfined
- env:
- http_proxy: "${http_proxy}"
- https_proxy: "${https_proxy}"
- no_proxy: "${no_proxy}"
- container: docker
 provisioner:
   name: ansible
   options:

Enter fullscreen mode Exit fullscreen mode

That’s it. :)

Top comments (0)