executable_git-diff-date 452 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. # $1 is a date, e.g 01.01.2022
  3. # $2 is a file, e.g. config/juniper.conf
  4. if [[ -z $1 ]]
  5. then
  6. echo "No date and file specified." 1>&2
  7. echo "Hint: git diff-date 01.01.2022 config/juniper.conf" 1>&2
  8. exit 1
  9. fi
  10. if [[ -z $2 ]]
  11. then
  12. echo "No file specified." 1>&2
  13. echo "Hint: git diff-date ${1} config/juniper.conf" 1>&2
  14. exit 1
  15. fi
  16. git diff "$(git log --format=%H --since="$1" --reverse | head -1)"..HEAD -- "$2"