Skip to content

Commit a6a73ff

Browse files
committed
Add the Git page.
1 parent a41ae9a commit a6a73ff

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

content/notes/Git.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
+++
2+
title = "Git"
3+
+++
4+
5+
Git is a free and open source distributed version control system.
6+
7+
Links:
8+
9+
- [Site](https://git-scm.com)
10+
11+
You might have been searching for the [list of my repositories](@/notes/Repositories.md) instead.
12+
13+
## Tips
14+
15+
### Searching commits
16+
17+
You can use `git log --grep` to find a commit that matches a specific keyword.
18+
19+
### Restoring files
20+
21+
Knowing a commit hash, you can view the tree related to that commit by calling `git show HASH:`. You can access any file in that tree by adding its relative path after the colon, for example, `git show HASH:path/to/file`. Thus, to restore a file, redirect the standard output somewhere, for example, `git show HASH:path/to/file > path/to/file`.
22+
23+
To restore all files in the current working tree, run `git restore :/`.

0 commit comments

Comments
 (0)