1

I pushed a commit with one changed file to Github. This was the first (and only) commit to this repo, which was forked from another user. I then changed the commit message using

git commit --amend -m "New message."
git push --force origin master. 

When I look at the main repo page on Github, the amended message is displayed above the file list, but the message displayed next to file name is the original commit message. Is there any way to force the amended message to be displayed next to the file name?

Martin G
  • 17,357
  • 9
  • 82
  • 98
user3065699
  • 329
  • 1
  • 8

1 Answers1

2

It should be a simple refresh or cache issue, because if that file is part of the new commit you just forced push, it will pick up the updated commit message.

In the OP's case, it seems that GitHub main repo page incorrectly refect its first push, while the list of commits did listed the right SH1 (the second push, replacing the first through a git push --force)

It is a refresh issue at the GitHub repo side.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I suspected that, but I've refreshed the page and even opened the page in a different browser and it still shows the old comment. If I go to the file page, that page shows the new comment, but the main repo page still shows the old comment next to the file. – user3065699 Apr 27 '14 at 07:41
  • @user3065699 Is that file history shows your new commit id? – VonC Apr 27 '14 at 07:42
  • @user3065699 does the main repo page shows the right commit SHA1 on the line of that file? – VonC Apr 27 '14 at 07:43
  • Is the commit SHA1 the long number to the right of the word 'commit'? (I'm still very new to git/Github.) If I click the new comment above the file list, I see a different number than if I click on the old comment next to the file name. – user3065699 Apr 27 '14 at 09:09
  • @user3065699 could you share the url of your repo, for me to have a look? – VonC Apr 27 '14 at 09:10
  • @user3065699 It seems you have done two different commits on top of the fork: https://github.com/bertworks1/ProgrammingAssignment2/commit/51fa4620d9203d6bb3b11719d5e1328c81a64072 and https://github.com/bertworks1/ProgrammingAssignment2/commit/ad4f3beec2354c0ae798793cc4753e8bd8ec34f2. The first one is a detached head (doesn't belong to any branch) – VonC Apr 27 '14 at 09:25
  • @user3065699 I am not sure why the main page choose to show the detached HEAd commit instead of the one in the master branch, but I would still suspect a refresh issue (on GitHub side). – VonC Apr 27 '14 at 09:28
  • Hmmm. OK, is there a way to delete the first commit? Or to delete both and start over? – user3065699 Apr 27 '14 at 09:30
  • @user3065699 simplest way would be to delete the fork, re-do a fork, clone it, and push again your commit. I would recommend to push it in a dedicated branch instead of `master` though: see http://stackoverflow.com/a/23285782/6309 and http://stackoverflow.com/a/14681796/6309 – VonC Apr 27 '14 at 09:34
  • yeah, I was starting to think that might end up being the easiest fix. Thanks for looking into it. – user3065699 Apr 27 '14 at 09:38