Article From:

Recently learn Flask web development. The code submission in the book is marked by chapters, including the GIT repository that modifies the complete history of the program.
Having clone as a repository, I now want to annotate the code submitted each time during the learning process so that I can understand it later. In general, however, git prevents subsequent versions of history from being checked out after a history commit has been modified.

The foolish way is to rebuild a new git repository, copy the original repository code, add comments to submit, check out the next version of the original repository, and copy.
It seems that you can use the GIT rebase command, but it’s not clear that there is a conflict with subsequent versions after modification. If each subsequent version has to modify the conflict, it seems like a dumb approach, too time-consuming?

Do you have any good idea? Or explain in detail that the GIT rebase command can solve this problem?

Answer 0:

You can use the GIT notes command.

This command will add note to the corresponding commit, just save it locally and do not modify the original commit.

Syntax: git notes add -m "notes content" to add commitid of notesExample: git notes add -m "this is a note" 88f377cdaa1a4363837aeFaa004a2d2a0a0343ba

You can use git log to view notes directly.
If not, use git log –notes

Answer 1:

You can try to build branches, and then play tag.
For example, you have an annotation in the first chapter.
git checkout -b first_chapter_with_comment Generating local branches
git push origin first_chapter_with_comment Distal establishment
git tag <*tagName > you label it here to facilitate your understanding later.
Do you think so?

Leave a Reply

Your email address will not be published. Required fields are marked *