blob: b25de0d96d064874f6fc46534a29ebae48d2b937 (
about) (
plain) (
blame)
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
48
49
50
51
52
53
|
---
layout: page
title: "TIL: Useful code snippets"
lang: en
ref: til
---
Useful code snippets[^source].
## Git custom work-tree checkout
```shell
git --work-tree=/path/to/outputdir checkout HEAD -- .
```
## Search in Git
Search log messages
```shell
git log --grep='Build 0051'
```
Search content in git history
```shell
git grep 'Build 0051' $(git rev-list --all)
```
## Find broken symlinks
```shell
find . -xtype l
```
## Kernel version
```shell
uname -r
```
## Sending email through the command line
```shell
mail eu@euandre.org -s "This is the subject" -aFrom:eu@euandre.org <<< 'This is the message'
```
## Git bisecting
Automatic Git bisect
```shell
git bisect start e1fd0a817d192c5a5df72dd7422e36558fa78e46 HEAD
git bisect run sh -c 'git clean -ffdx && ./bootstrap && ./configure --localstatedir=/var && make && git checkout'
```
[^source]: Shameless rip-off of [Anna e só](https://til.flourishing.stream/)
|