Git design rationale Updated 2025-07-16
The fundamental insight of Git design is: a SHA represents not only current state, but also the full history due to the Merkle tree implementation, see notably:
This makes it so that you will always notice if you are overwriting history on the remote, even if you are developing from two separate local computers (or more commonly, two people in two different local computers) and therefore will never lose any work accidentally.
It is very hard to achieve that without the Merkle tree.
Consider for example the most naive approach possible of marking versions with consecutive numbers:
GitHub Updated 2025-07-16
This is where Ciro Santilli stored his code since he started coding nonstop in 2013.
He does not like the closed source aspect of it, but hey, there are more important things to worry about, the network effect is just too strong.
Git tips
diff3 Updated 2025-07-16diff3 conflict is basically what you always want to see, either by setting it as the default as per stackoverflow.com/questions/27417656/should-diff3-be-default-conflictstyle-on-git:git config --global merge.conflictstyle diff3git checkout --conflict=diff3With this, conflicts now show up as:
++<<<<<<< HEAD
+5
++||||||| parent of 7b0f59d (6)
++3
++=======
+ 6
++>>>>>>> 7b0f59d (6)7b0f59d is the SHA-2 of commit 6.instead of the inferior default:
++<<<<<<< ours
+5
++=======
+ 6
++>>>>>>> theirsWe can also observe the current tree state during resolution:so we understand that we are now at 5 and that we are trying to apply our commit
* b4ec057 (HEAD, master) 5
* 0b37c1b 4
| * fbfbfe8 (my-feature) 7
| * 7b0f59d 6
|/
* 661cfab 3
* 6d748a9 2
* c5f8a2c 16So it is much clearer what is happening:and so now we have to decide what the new code is that will put both of these together.
We now reach:and the tree looks like:So we understand that:
++<<<<<<< HEAD
+11
++||||||| parent of fbfbfe8 (7)
++6
++=======
+ 7
++>>>>>>> fbfbfe8 (7)* ca7f7ff (HEAD) 6
* b4ec057 (master) 5
* 0b37c1b 4
| * fbfbfe8 (my-feature) 7
| * 7b0f59d 6
|/
* 661cfab 3
* 6d748a9 2
* c5f8a2c 1and after resolving that one we now reach:
* e1aaf20 (HEAD -> my-feature) 7
* ca7f7ff 6
* b4ec057 (master) 5
* 0b37c1b 4
* 661cfab 3
* 6d748a9 2
* c5f8a2c 1 Git tips gitk Updated 2025-07-16
OpenSuperQ Updated 2025-07-16
OpenSuperQ intro by Quantum Flagship (2021)
Source. Git tips
git mergetool with meld or kdiff3 Updated 2025-07-16These are good free newbie GUI options:
sudo apt install meld
git mergetool --tool meld
sudo apt install kdiff3
git mergetool --tool kdiff3git-tips-2.sh
#!/usr/bin/env bash
set -eux
add() (
rm -f f
for i in `seq 10`; do
printf "before $i\n\n" >> f
done
printf "conflict 1 $1\n\n" >> f
for i in `seq 10`; do
printf "middle $i\n\n" >> f
done
printf "conflict 2 $2\n\n" >> f
for i in `seq 10`; do
printf "after $i\n\n" >> f
done
git add f
)
rm -rf git-tips-2
mkdir git-tips-2
cd git-tips-2
git init
for i in 1 2 3; do
add $i $i
git commit -m $i
done
add 3 4
git commit -m 4
add 5 4
git commit -m 5
git checkout HEAD~2
git checkout -b my-feature
add 3 6
git commit -m 6
add 7 6
git commit -m 7 Git tips git rebase moves commits one by one Updated 2025-07-16
In order to solve conflicts, you just have to understand what commit you are trying to move where.
E.g. if from:we do:what happens step by step is first 6 is moved on top of 5:and then 7 is moved on top of the new 6:
5 master
|
4 7 my-feature HEAD
| |
3 6
|/
2
|
1git rebase master6on5 HEAD
|
5 master
|
4 7 my-feature
| |
3 6
| |
2-----------------+
|
17on5 HEAD
|
6on5
|
5 master
|
4 7 my-feature
| |
3 6
| |
2-----------------+
|
17on5 my-feature HEAD
|
6on5
|
5 master
|
4
|
3
|
2
|
1 Git tips It's not a tree, it's actually a DAG Updated 2025-07-16
But not every directed acyclic graph is a tree.
Example of a tree (and therefore also a DAG):Convention in this presentation: arrows implicitly point up, just like in a
5
|
4 7
| |
3 6
|/
2
|
1git log, i.e.:and so on. Git tips Oh, but there are 2 trees: local and remote Updated 2025-07-16
Oh but there are usually 2 trees: local and remote.
So you also have to learn how to observe and modify and sync with the remote tree!
But basically:to update the remote tree. And then you can use it exactly like any other branch, except you prefix them with the remote (usually
git fetchorigin/*), e.g.:origin/masteris the latest fetch of the remote version ofmasterorigin/my-featureis the latest fetch of the remote version ofmy-feature
Git tips Why is Git a DAG? Updated 2025-07-16
Globalization reduces the power of governments Updated 2025-07-16
While Ciro Santilli is a big fan of having "one global country" (and language), which is somewhat approximated by globalization, he has come to believe that there is one serious downside to globalization as it stands in 2020: it allows companies to pressure governments to reduce taxes, and thus reduces the power of government, which in turn increases social inequality. This idea is very well highlighted in Can't get you out of my head by Adam Curtis (2021).
The only solution seems to be for governments to get together, and make deals to have fair taxation across each other. Which might never happen.
Global warming Updated 2025-07-16
GNOME Project Updated 2025-07-16
GNU Core Utils command line utility Updated 2025-07-16
Non-POSIX only here.
GNU Free Documentation License Updated 2025-07-16
GNU General Public License Updated 2025-07-16
Mouse brain Updated 2025-07-16
Bibliography:
- www.nature.com/articles/d41586-023-02559-9 The quest to map the mouse brain by Diana Kwon (2023)
GNU parallel Updated 2025-07-16
This program makes you respect GNU make a bit more. Good old make with
-j can not only parallelize, but also take in account a dependency graph.Some examples under:
man parallel_exampesTo get the input argument explicitly job number use the magic string sample output:
{}, e.g.:printf 'a\nb\nc\n' | parallel echo '{}'a
b
cTo get the job number use sample output:
{#} as in:printf 'a\nb\nc\n' | parallel echo '{} {#}'a 1
b 2
c 3
c 3{%} contains which thread the job running in, e.g. if we limit it to 2 threads with -j2:printf 'a\nb\nc\nd\n' | parallel -j2 echo '{} {#} {%}'a 1 1
b 2 1
c 3 2
d 4 1% symbol in many programming languages such as C.To pass multiple CLI arguments per command you can use sample output:
-X e.g.:printf 'a\nb\nc\nd\n' | parallel -j2 -X echo '{} {#} {%}'a b 1 1
c d 2 2 GNU Project Updated 2025-07-16
Go engine Updated 2025-07-16
There are unlisted articles, also show them or only show them.


