我发现了一个问题 drupal.org 我想提交一个解决方案。如何使用git创建一个补丁,以便可以将其作为可能的修复提交?

有帮助吗?

解决方案

每个drupal.org项目都有一个选项卡标题“版本控件”,单击它,它将带您进入带有GIT指令的页面,包括标题为“创建补丁”的部分。

请参阅此处的示例: http://drupal.org/project/wysiwyg_fields/git-instructions

以下代码从DO指令中复制。

git checkout -b [description]-[issue-number]

进行更改。注意与发行相关的提交消息的语法更改。看到 提交消息 页面以获取详细信息。

git add -A
git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."

滚动补丁。

git status
git fetch origin
git rebase origin/6.x-1.x
git format-patch origin/6.x-1.x --stdout > [description]-[issue-number]-[comment-number].patch

其他提示

如果您使用phpstorm或Intellij,则可以执行以下操作:

  • 确保您的分支是最新的(提交一切)
  • 进行更改(修复错误)
  • 转到VCS>创建补丁

    Go to VCS  loading= Create patch ">

  • 按照这些步骤进行操作,并保存您喜欢的位置。

    Follow the steps and save where you prefer it

我不会过度复杂的事情。最后,您真正需要的只是模块的开发版本,在其中启动一个空的git repo,清洁工作树(提交所有内容,只是本地),进行更改,然后运行以下命令。

$ git diff > [short_description]-[issue-number]-[comment-number].patch

在逐步逐步归结为以下内容。

  1. 有一个本地的Drupal跑步,您可能会陷入困境。
  2. 将模块的开发版本下载到您本地的Drupal的Convor Modules文件夹中。
  3. 现在 cd 进入模块的目录和 git init, , 然后 git add .git commit -m "Clean tree" 要有一个干净的状态。
  4. 进行代码更改,并使用本地Drupal检查一切是否正常,最后运行 git diff 从上方命令。
  5. 将补丁上传到drupal.org上,并将问题设置为“需要审查”。
许可以下: CC-BY-SA归因
scroll top