Hide some nasty stuff 💩 in Github
- Get the commit hash on specific commit
$ git log --all --grep='search_string' --pretty='format:%h'
5125aee
- Then use it to get blob hash of some specific file
$ git ls-tree 5125aee --abbrev filename_or_folder
100644 blob_or_tree 15561e5 filename_or_folder
Be carefull git ls-tree
follow the format <unixPermission_mode> SP <blob/tree> SP <hash_object> TAB <file/folder>
- Make some notes
$ git notes --ref utopian add 15561e5
hint: Waiting for your editor to close the file...
- Push it to remote repository (
refs/notes/*
if you want to push all notes)
$ git push origin refs/notes/utopian
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.22 KiB | 626.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:DrSensor/git-notes.git
* [new branch] refs/notes/utopian -> refs/notes/utopian
After pushed, you can check it in the repository via this url https://github.com/`username`/`project`/tree/refs/notes/utopian
- To fetch it, you can use (
refs/notes/*:refs/notes/*
if you want to fetch all notes):
$ git fetch origin refs/notes/utopian:refs/notes/utopian
- Then you can inspect it using
$ git notes --ref=utopian show 15561e5
From github.com:username/project
* [new ref] refs/notes/utopian -> refs/notes/utopian