Thank you all for responding.
I am translating this (I do not speak English), so I am having difficulty communicating clearly what I am trying to describe.
Apologies.
I will try to improve my questions, with a practical example.
I am using a local, non-cloned repository created with git init
; when you clone a repository the logs from the git reflog
command are removed.
git version 2.29.2.windows.2
In SM2, you can edit a commit message by simply doing (responding to @srbs):
Edit Commit -> Edit Commit Message
Change the message and do enter, well, it looks great!!!
Now if you do via git reflog
console, you discover that the original commit message is there, instead of seeing the new one. Also, maybe the best thing is that git reflog
, shows nothing has changed.
I say this “maybe best” because, I only changed the message, not the content of the commit, so why make a fuss.
But the point here is, that the new message is not displayed by the git reflog
command.
If you use git log
, now you see the new commit message, which was edited with SM2.
Also if you use the git shortlog
command, you can also see the new message that put the commit of your interest.
But also, you can see the date and time of the original commit, just before modifying the commit message with SM2.
However, SM2 shows the date of issue of the Commit Message, in the commit tree.
Instead of the date the commit was made.
In fact, SM2 adds the edit date of the message alongside the original commit date.
As @OdatNurd says a new commit “is born”, you can notice this immediately in SM2, a different Commit Hash is shown, as well as via console.
But if a new commit it is created or born when editing your message:
Why is the date and time of the original commit visible in SM2 and via console?
There is still a little more…
You can edit a commit message, further back in time, using the command git rebase -i head~x
For example: git rebase -i head~7
The default editor indicated in the git configuration will open.
You will have to replace in the line of interest, to modify the commit message, [ pick ] by [ reword ] and save the changes and close the editor.
Then the editor will open again, with a single line, containing the commit message, there you write the new message for the commit, save the changes and close the editor.
Now via console run git reflog
, you will see a lot of new information, which records your edit of the commit message.
Now if you load the repo into SM2, you will of course see the new commit message.
You will also see the new message for your commit, doing git log
and git shortlog
.
Because of all this, I wonder, how the hell SM2 changes the message of a commit, further back in time, of the most recent commit.
So I asked, what is the equivalent command.
On the other hand…
Also SM2, in the commit tree, shows the date of the commit message, and this is propagated from the bottom (old commit with its modified message) to the last commit made.
I understand that this must be by design of git, since when using rebase from the console, SM2 shows the same behavior.
But as it is, when modifying a message from an old commit, in SM2, it ended up seeing how it modified all the commits in the same second, until the last commit made.
I think this deserves an option to change the behavior of SM2, in the SM2 commit tree, to show the date of the commits, instead of the edit date of the commit message.
The latter is at the cost of exploiting the bug in git, that despite generating a new commit, when modifying its message, the date of the original commit remains.
Greeting.