1.9 KiB
Part 1: Viewing File History
git log -- filename.extension
git log -p -- filename.extension
git log --oneline -- filename.extension
How many commits modified this file? 3
What differences do you see when adding the -p option? It describes what changed — which lines were added (+), which lines were removed (−)
Part 2: Viewing File History with Blame
git blame -- filename.extension
git blame -L 1,5 -- filename.extension
git blame -e -- filename.extension
Who changed each line of the file? Arjun,Renejit, Arjun, Arjun ec0f5f8e (Arjun G 2025-09-10 23:41:01 +0530 1) Tech Thursday assignment 3 updated ae37ccf5 (Renejit 2025-09-10 16:29:53 +0530 2) date 10-09-2025 f97b76b3 (Arjun G 2025-09-11 00:00:58 +0530 3) wednesday dc7fc330 (Arjun G 2025-09-11 00:01:50 +0530 4) Practise session extended to Thursday
How does -L help when the file is large? Limits the blame output to just a range of lines when the file is large.
What extra information does -e provide? Author email
Part 3: Merging Branches
git checkout -b feature/feature-1
git merge feature/feature-1
git log --graph --oneline --all
Did Git perform a fast-forward merge or a 3-way merge? 3 way merge
What does git log --graph --oneline --all show after the merge? shows a merge commit (06f4ad1) at the top. The graph shows two diverging branches (main & feature/feature-1) and how they were joined together. main now contains all changes from both histories.