Skip to content

Instantly share code, notes, and snippets.

@gesellix
Created October 10, 2019 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gesellix/00675bf2c520ca96e7f3060dbab985d8 to your computer and use it in GitHub Desktop.
Save gesellix/00675bf2c520ca96e7f3060dbab985d8 to your computer and use it in GitHub Desktop.
git 303
echo “foo” > example.txt
### add to .git/objects
git hash-object -w example.txt
git cat-file -p <blob-hash>
find .git/objects -type f
### add file to .git/index (“stage”)
git update-index ---add --cacheinfo 100644 <blob-hash> example.txt
### create tree node (from staged index)
git write-tree
git cat-file -p <tree-hash>
### add commit
echo "add example" | git commit-tree <tree-hash>
git cat-file -p <commit-hash>
### change a file
echo "baz" >> example.txt
git update-index example.txt
git write-tree
echo "update example" | git commit-tree <commit-hash-2> -p <commit-hash (von oben)>
#### git log doesn't show the new commits?!?!?
### `master` needs to be linked to the desired commit:
echo <commit-hash> > .git/refs/heads/master
@gesellix
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment