English 中文(简体)
在 GitHub 中编辑 Git 发送信件
原标题:Editing the git commit message in GitHub

在提交后,是否有办法在线编辑 GitHub.com 中的承诺信息?

从指挥线,人们可以做到

git commit --amend -m "New commit message"

如下问题正确建议:

尝试 git pull git push 有效( 没有任何其它行为干扰平均时间 ) 。

但能否通过GitHub 网站完成?

最佳回答

不, 这是无法直接实现的 。 每个 Git 承诺的杂件也是根据承诺信息计算的 。 当您更改承诺信息时, 您会更改承诺信息 。 如果您想要强制实施承诺, 您必须强制实施( git push - f ) 。 但是, 如果有人已经拉动了您以前的承诺, 并根据承诺启动了一项工作, 他们就必须将自己的工作重新定位在您的新承诺上 。

问题回答

GitHub s instructions for doing this:

  1. On the command line, navigate to the repository that contains the commit you want to amend.
  2. Type git commit --amend and press Enter.
  3. In your text editor, edit the commit message and save the commit.
  4. Use the git push --force origin example-branch command to force push over the old commit.

资料来源:https://help.github.com/articles/search-a-commit-message/

您需要使用 git push -f 的假设, 假设以前没有人拉过其他任务。 请注意, 您正在改变历史 。

For intellij users: If you want to make changes in interactive way for past commits, which are not pushed follow below steps in Intellij:

  • Select Version Control
  • Select Log
  • Right click the commit for which you want to amend comment
  • Click reword
  • Done

希望有帮助

否,因为承诺信息与承诺SHA/hash有关,如果我们改变它,承诺SHA也会改变。我所用的方式是就承诺提出评论。我无法反感。

for Android演播室/Intellij 用户:

  • Select Version Control
  • Select Log
  • Right click the commit for which you want to rename
  • Click Edit Commit Message
  • Write your commit message
  • Done

有人要求我修改我在Github上提交的贴补丁信息, (最后还是在这里)。这就是我为完成任务所做的。

git clone [email protected]:YOURNAME/EXAMPLE.git; cd EXAMPLE; git fetch --all; git pull --all
git checkout -b patch-2 origin/patch-2 # create local patch-2 branch
git commit --amend # update the commit message
git push -f

这对分支上的最后一项承诺有效。 如果相关承诺的深度更大, 您需要做一些更复杂的事情 。 (我不知道是否需要获取和拉动, 但我只是在做其他工作以节省时间时通过这条线 。 )

我正面临同样的问题

以你的项圈为分支,你将知道那个分支中第一个被约束者的模样。你应当谨守下列律例:

git rebase -i <Commit SHA of first commit>

编辑器会打开。 使用 Github 界面和打开编辑器跟踪您的承诺, 并更改信件 。

视觉演播室用户 <强>:

You are able to modify the commit message from the commit tab by clicking Unpushed Commit (1) and the View Outgoing/Incoming option (2). Then, once comment is modified (3), Amend Message option (4) is enabled and changes are performed automatically in the commit.

测试VS 2019





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签