W dniu 21.08.2016 o 17:19, n...@dad.org pisze:

> I am learning how to use git. I would like to know:
> 
> How can I correct a typo in the message I gave to an old "git commit"? I see
> that the typo occurs in exactly two files in .git:
> 
> .git/logs/refs/heads/master
> .git/logs/HEAD
> 
> /usr/bin/file says that they are both ASCII English text. So I could just
> hand edit them. But that seems somehow sacrilegious and might break git.

As the pathname suggests, those two files are only *logs*, to be more
exact these store so called reflogs, which allow for example use @{1}
for previous position of current branch in your local repository, or
"git checkout -" (or "git checkout @{-1}") to go back to previous branch.
You can edit them (just take care to not touch the rest of line / file),
but it wouldn't change what is in your history, what 'git log' would show.

If the typo was in the last commit you have created, the simplest solution
is to use 'git commit --amend' (assuming that you didn't 'git add' any files
in meantime).

If it was something few commits back, you need to use 'git rebase 
--interactive',
starting from the commit before the one you want to change.  Then you need
to change 'pick' to 'reword', as described in instruction sheet for interactive
rebase. 


P.S. Good source of finding answers is StackOverflow[1], and new (and in beta)
StackOverflow Documentation

[1]: http://stackoverflow.com/questions/tagged/git 
[2]: http://stackoverflow.com/documentation/git

There is also #git channel on FreeNode[3]

[3]: ircs://chat.freenode.net:6697/git
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to