How to edit a pressed commit message using rebase?

It's hard for me to try to figure out how to edit a git commit post that has already been ported to GitHub. I could swear that in the past I used the same command to edit the git commits already pressed and did not have any problems that have ever been so. The problem that I am facing now, when I run git rebase --interactive <SHA of commit>, I get something similar to this ...

noop

# Rebase 5d8e041..5d8e041 onto 5d8e041 (1 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

When I run the same command, but with a git commit that has not yet been pressed before GitHub, everything works fine. Is there something I'm missing? As I said before, I could have sworn that this once worked wonderfully with jerks and unmanaged commits.

Many thanks for your help. I am very grateful.

+4
4

, git rebase -i <sha> , , reword . , 64bit 32bit. , , post GitHub, , 64bit , git rebase git merge . , ...

git, , sh.exe.stackdump STATUS_STACK_OVERFLOW + .

, git. , SmartGit, git. , git git, , Rebase Interactive From. , 10 , .

, , , , . 64bit git , 32bit? . , , , .

+2

, "" ( , , - upvoted - nnovich-OK answer).

GitHub, git push --force ( --force-with-lease, )


git rebase -i 5d8e041~1, Current branch master is up to date

, addinf --force.

+1

/ . . rebase, git rebase --interactive <SHA of PARENT commit>, . Rebase commit, commit , git noop .

, git commit --amend, .

+1

parent, , .

, git, :
$ git log --oneline

5cd3b9a (HEAD -> master) Hi I'm John, I'm a bad commit message
b6266a5 Hi, I'm the parent of John
j45cj33 And I'm the grand parent of John
...

commit:

git rebase --interactive b6266a5

Then change the word pickto reword. When you save and exit, a new editor will open that allows you to change the commit message.

To update github, you must use force . If your branch is called a master, do the following:

$ git push --force origin master

Keep in mind that this will rewrite history on github. If you are rewriting a story after someone has already pulled it out of github, you will be asking problems.

0
source

Source: https://habr.com/ru/post/1688380/


All Articles