2024-02-29
Published:
Following my friend Yining Ye, and inspired by Wandai Blog who kept this habit for more than 10 years, I started to write a simple sentence-level daily log to deal with my pressure during Ph.D. study. I hope I can keep this habit for a long time.
After the painful lesson of forgetting to commit my code last week, I spent some time today writing a script to automatically commit and tag the code each time I run an experiment.
def save_git_patch(run_dir: Path):
# create temperate commit, tag, then reset back
from git import Repo
repo = Repo(search_parent_directories=True)
repo.git.add(".")
# if working tree is clean, return
if not repo.is_dirty():
repo.git.tag("run/" + "/".join(run_dir.parts[-4:]))
return
repo.git.commit(
"-m", "[TEMPORY]" + "/".join(run_dir.parts[-4:]), "--no-gpg-sign", "--no-verify"
)
repo.git.tag("run/" + "/".join(run_dir.parts[-4:]))
repo.git.reset("--mixed", "HEAD~1")
Also spend some time updating my homepage for the daily log (this page).
After a project meeting in the late night, it feels like I’m about to work OT every day again.