![]() ![]() Usually we use git commit -amendTo modify the latest submitted message, how to modify the commit message of historical submission. Amend does not modify the historical submission information ![]() ![]() No HEAD^2You have to write HEAD~2perhaps HEAD^1^1 ? fatal: ambiguous argument 'HEAD^2': unknown revision or path not in the working tree. So you think there is git diff HEAD HEAD^2How to use it? That’s wrong. This refers to the comparison between the previous version of head and the previous version of head, which is equivalent to git diff HEAD HEAD^1^1Is also equivalent to git diff HEAD HEAD~2 This means that the comparison between the head and the previous version of the head is equivalent to git diff HEAD HEAD^1Is also equivalent to git diff HEAD HEAD~1 git diff HEAD HEAD^^ When diff commit, you often need to check the difference between the current commit and the previous version or the previous version, ^and ~The two uses of the operator of are different git diff HEAD HEAD^ (END) The difference between two operators in head version comparison If you want to keep it by creating a new branch, this may be a good timeįollow the prompts and use the command git branch xxx 9a78be9You can create branches and keep all these commit git branch -a Warning: you are leaving 1 commit behind, not connected to If the checkout branch at this time, the submitted content will be discarded by git at a later point in time. Submit the commit and you will be prompted to modify the detached head git commit -am 'modify' No changes added to commit (use "git add" and/or "git commit -a") " to discard changes in working directory) At this time, modify the contents of the file diff -git a/fdsa b/fdsa If you want to create a new branch to retain commits you create, you mayĭo so (now or later) by using -b with the checkout command again. State without impacting any branches by performing another checkout. You can look around, make experimentalĬhanges and commit them, and you can discard any commits you make in this You can see that there are two submission records 7c53c63 (head - > Master) create fileĪt this time, checkout to the historical version Note: checking out 'c034a61'. If you want to keep it, you need to create a new branch manually. The separation header refers to that after checking out the historical version, you make changes and submit the commit, then you switch back to other branches, and the previously submitted commit will be discarded. Talk about the detached head, amend, rebase and reset in GitĪ kind of More front-end technology and knowledge points, search subscription number JS bacteriaSubscribe Commit lost due to header separation ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |