-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit-tree.notes
More file actions
47 lines (37 loc) · 989 Bytes
/
Copy pathcommit-tree.notes
File metadata and controls
47 lines (37 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
* // ---------- TREE-ISH ---------- // *
// A directory containing files and other directories or any identifier which references a tree
// A commit is considered tree-ish because it refers to a tree at the point when a commit has been applied
Tree-ish examples:
- SHA-1 hash
- HEAD pointer reference
- Branch reference
- Tag reference
- Ancestry
# Shows what is in a commit
git show <SHA-1>
git show HEAD
* // ---------- ANCESTRY ---------- // *
# Get the parent
<SHA-1> ^ // carrot
<SHA-1>^
OR:
<SHA-1> ~ // Tilda
<SHA-1>~
# Go back one generation
HEAD~1
# Grandparent (go back two generations)
<SHA-1>^^
master^^ // Can use branch reference too
HEAD~2
# Great-Grandparent
<SHA-1>^^^
HEAD^^^
master^^^
HEAD~3
* // ---------- TREE LIST ---------- // *
# List a tree
git ls-tree <tree-ish>
# List all files within a directory
git ls-tree HEAD assets/
// Blobs (Binary Large Object) is a reference to something like a file
// Tree is a reference to a directory