Переименовать локальный коммит в git
I'm imaging now that you tried to use git revert to undo the commit but it ends you up with additional commit, Here is a solution for you. use git log --oneline to show you your logs, You gonna find the commit with wrong message, Besides it you gonna find its hash (like 53fnd3w) copy it then type
git reset --hard <paste-the-hash>
This will lead you to go back to that commit, after that if you wanna just change the name of the commit use
git commit --amend -m "New commit message"
This gonna make you change the name of the latest commit which is the one you are standing on, But if you want to undo these changes because you want to divide them on two commits or something, Use
git reset HEAD^
This gonna return you back for the commit that is previous of the current one with changes un-committed, Once you make a new commit it will ignore the commits after HEAD^ and you gonna see only the new commit when you make
git log --oneline
Комментариев нет:
Отправить комментарий