深度阅读

How to add a note to a commit with git notes command

作者
作者
2023年08月22日
更新时间
9.24 分钟
阅读时间
0
阅读量

When you change a part in Git, you can add a message with it.This message is basically a note that you can add to the commit.

However, sometimes, you may want to add additional notes to the commit.

Git Notes

You can do so using git notes command.

$ git notes add -m "Deleted script.html because it was no longer needed" f0a40dfff6582a516dd47d4bde8831b45e4ec40d

Now, when you run the git log command, you’ll see the note added to the commit .

➜  test git:(master) git log
commit f0a40dfff6582a516dd47d4bde8831b45e4ec40d (HEAD -> master)
Author: Amit Merchant 
Date:   Sun Jan 1 18:48:30 2023 +0530

    deleted a file

Notes:
    Deleted script.html because it was no longer needed

Update a note

In any case, if you want to update the note, you can do so command like so.

git notes add -f -m "Version 2 of the note" f0a40dfff6582a516dd47d4bde8831b45e4ec40d

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。