Raveen Kumar

GIT

Never rebase

Never rebase if you commit frequently. Merge is the correct option. Rebase could miss some changes.

2023-01-08 - Grep for a string or a change in all the commits

Also called git pickaxe This will find any string that ever existed in that repo.

git log  -S <string> -p

Removing large files and sensitive files from repo.

I accidentally uploaded about 1.7 GB of data into GitHub, and GitHub only accepts 100 MB max file size.

I found this documentation on removing this file.

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository

And this nifty little program to do this.

https://rtyley.github.io/bfg-repo-cleaner/

Everything worked as expected and that file is removed from my commit history and repository.

bfg --delete-files "A Video of this ice cube melting.mp4"
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push --force

Reading Materials

https://jeremykun.com/2020/01/14/the-communicative-value-of-using-git-well/

There is a famous quote by Hal Abelson, that “Programs must be written for people to read, and only incidentally for machines to execute.”

https://www.gonsie.com/blorg/quote-hal-program-for-people.html

https://jwiegley.github.io/git-from-the-bottom-up/

Git diff between to branches

https://stackoverflow.com/questions/822811/showing-which-files-have-changed-between-two-revisions

git diff --name-status main
or
git diff --name-status firstbranch..yourBranchName

#Git #Scm #Version-Control