git-basics
git-basics
git init
git add
git commit
git log
Commits
as Bank Transactions
Tx ID: <unique_id>
Date: <date_and_time>
Total: 1450
Description: Groceries
Amount: -50
Tx ID: <unique_id>
Date: <date_and_time>
TIME
Total: 1000 Description: Initial deposit
Amount: +1000
Commit ID: <sha_id>
Date: <date_and_time>
Author: <author>
Repo state: f(sha_id) Description: <description>
Parent:
TIME
Parent: none
Git commits are incremental
state changes
diff --git a/count.txt b/count.txt
Before index ba70c99..a982fdc 100644 After
--- a/count.txt
Line 1 +++ b/count.txt Line 1
Line 2 Line 2
@@ -1,6 +1,8 @@
Line 3 Line 3
Line 1
Line 3 Line 4
Line 4 Line 2 Line 5
Line 8 Line 3 Line 6
Git diff -Line 3
Line 4
Line 7
Line 8
+Line 5
+Line 6
‘a’ or ‘-’ +Line 7 ‘b’ or ‘+’
Line 8
• Download the source code of JUnit4 unit-testing
framework to your machine
• Find the author, the date and the description of
commit 0bb3dfe29
Exercise 2
• How many files were affected by this commit
(hint: use --name-status flag)
• Review the code changes introduced by this
commit (no need to understand the code)
Lifecycle of a File in Git
Untracked Unmodified Modified Staged
add
commit
edit
stage
remove
One pattern per line
# … comment