Offtopic
Git toggled folders as submodules!?
Few days ago, i had to struggle with a strange scenario in which git began tracking a folder, as if it was a submodule.
Now, what’s strange with that?: i didn’t set any submodules!. My .gitmodule file was empty (in fact, i didn’t even have that file).
Thanks to this stackflow question, i ended up figuring out this solution:
git ls-files --stage | grep 160000
git rm --cached [Paths retrieved from the command above]Hopefully, this will help another lost soul!
Shrinking EBS Volume
It took me a while to shrink my EBS volume, but this post helped quite a lot. For further reference, this are the exact steps i’ve performed:
- Created a snapshot of the EBS volume, for backup reasons.
- Added a new volume, based on the snapshot.
- Added another volume with the desired size.
- Attached both, the Normal and Shrunken volumes.
- Check the big volume, and resize it:Resizing the filesystem on /dev/xvdg to 1035624 (4k) blocks.
e2fsck -f /dev/bigvolume resize2fs -M -p /dev/bigvolume ```- Note that 'resize2fs' will say something like:x = 1035624 * 4 / 1024 / 16 = 253- Let's calculate how many 16MB blocks we'll need:dd bs=16M if=/dev/bigvolume of=/dev/smallvolume count=253- Proceed copy'ing blocks to the small volume:resize2fs -p /dev/smallvolume e2fsck -f /dev/smallvolume- Resize + Check the small volume:- Stop the instance. - Detach the 3 volumes: Root, Big and Small. - Attach the *Small* volume at the same location as the previous root volume was. In my case, /dev/sda1. - **Ready!**
Nuke GIT Repository History
Suppose you’ve just commited a private API key that should not be public. Or maybe you just wanna restart your repository, because you’ve just finished major surgery and wanna start fresh.
If you’d like to delete all GIT history, you’d need to:
- Remove all history
rm -rf .git- Reconstruct the Git repo with only the current content
git init
git add .
git commit -m "Initial commit"- Push to GitHub.
git remote add origin <github-uri>
git push -u --force origin master
