6.4 Important Git Features
6.4.4 Exercises
-
Look at the help pages for
git logandgit diff.$ git help log $ git help diff -
Add to the
.gitignoreyou already started to include a specific file name, then add that file to your repository.$ echo "specific_file_name" >> .gitignore $ touch specific_file_name -
Create a file that contains the Git log for this repository. Use
grepto see which day of the week most of the commits occurred on.$ git log > log_file.txtNext, write this script:
#!usr/bin/env bash # File: log_info.sh week_days=(Sat Sun Mon Tue Wed Thu Fri) max_num=0 max_day="No Day" for day in ${week_days[*]} do num=$(grep $day log_file.txt | wc -l) if [[ $num -gt $max_num ]] then let max_num=$num max_day=$day fi done echo "$max_day: $max_num"Then, run the script:
$ bash log_info.sh