git

Git under the hood

Materials https://gitready.com/beginner/2009/02/17/how-git-stores-your-data.html https://de.slideshare.net/JeffKunkle/understanding-git Object types in Git Blob Tree Commit Tag <= Skip in this post These objects are stored in .git/objects/. How to read the objects Git objects are compressed. # Get file information $ git ls-files -s {{ my_git-managed_file }} 100644 4be0b2b8b0fd36b8b3c94c46b4af4cfb2558d11c 0 {{ my_git-managed_file }} # Decompress the Git object $ pigz -d < .git/objeccts/4b/e0b2b8b0fd36b8b3c94c46b4af4cfb2558d11c blob 7572my Markdown file!! # Another object (tree) $ git ls-tree HEAD // --- snipp --- // 040000 tree 423d17368f16ff18aac8ee494e27bafef8587afa content $ pigz -d < .

Migrate Hugo blog repository (but delete all Git commits)

My real case Migrate repository from BitBucket to GitHub. I could delete Commit histories. What I’ve done Update .gitignore. Delete docs directory. Update netlify.toml [build] publish = "docs" command = "hugo --gc --minify" [context.production.environment] HUGO_VERSION = "0.87.0" rm -rf data #old dir structure rm -rf .git rm -rf theme/mainroad git init git submodule add git@github.com:Vimux/Mainroad.git themes/mainroad git config --global user.name atlex00 git config --global user.email ... git commit git push origin master --force

Snippets of Git

Completely delete submodule from the repository Here is the graceful memo. I copy&paste it to here. To remove a submodule you need to: Delete the relevant section from the .gitmodules file. Stage the .gitmodules changes git add .gitmodules Delete the relevant section from .git/config. Run git rm –cached path_to_submodule (no trailing slash). Run rm -rf .git/modules/path_to_submodule (no trailing slash). Commit git commit -m “Removed submodule ” Delete the now untracked submodule files rm -rf path_to_submodule Do you forgot to clone with --recursive ?