Integrated operation of fork and Ideal in Git

ork + PullRequest mode

Collaborative workPull Request Fork

The most commonly used and recommended preferred way to participate in warehouse development in Gitee is the "Fork + Pull" mode. In the "Fork + Pull" mode, warehouse participants do not need to apply to the warehouse creator for submission permission, but build a fork (Fork) of the warehouse under their own hosting space. As for commits created in forked repositories, it is very convenient to use Gitee's Pull Request tool to send a Pull Request to the maintainer of the original repo.

1. What is a Pull Request?

Pull Request is a way for two warehouses to submit changes. It is usually used for the difference submission between the fork warehouse and the forked warehouse. It is also a very good team collaboration method. Next, let’s explain how to submit Pull Request on the Gitee platform:

PS: The Gitee platform restricts the Pull Request source warehouse and target warehouse to have a fork and fork relationship, so if you want to submit a Pull Request, you must first fork a warehouse, and then submit a Pull Request to the warehouse. At the same time, use this warehouse as the parent You can also submit Pull Requests for all warehouses in the warehouse.

2. How to fork the warehouse

It is very simple to fork a warehouse. Enter the warehouse page, then find the fork button in the upper right corner, click and select the namespace to fork, and then click OK, and wait for the system to complete the warehouse clone operation in the background, and the fork operation is completed, as shown in the figure :

3. How to submit a Pull Request

First, there must be a difference between your warehouse and the target warehouse, so that you can submit, for example:

If there is no difference, or the target branch is newer than the branch you mentioned in the Pull Request, you will get this prompt:

Then, fill in the description of the Pull Request, click Submit Pull Request, and you can submit a Pull Request, as shown in the figure below:

4. How to manage the existing Pull Request

首先,对于一个已经存在的 Pull Request,如果只是观察者,报告者等权限,那么访问将会受到限制,具体权限限制请参考 Gitee 平台关于角色权限的内容,下文涉及的部分,仅针对管理员权限,如果您发现不太一样的地方,请检查您的权限是不是管理员或该 Pull Request 的创建者。

5、如何修改一个已经存在的 Pull Request

点击 Pull Request 的详情界面右上角的编辑按钮,就会弹出编辑框,在编辑框中修改你需要修改的信息,然后点击保存即可修改该 Pull Request,如下图所示:

请注意,在该界面,可以对 Pull Request 进行指派负责人,指派测试者等等操作,每一个操作均会通知对应的人员

6、对 Pull Request 的 bug 修改如何提交到该 Pull Request 中

对于 Pull Request 中的 bug 修复或者任何更新动作,均不必要提交新的 Pull Request,仅仅只需要推送到您提交 Pull Request 的分支上,稍后我们后台会自动更新这些提交,将其加入到这个 Pull Request 中去

7、Pull Request 不能自动合并该如何处理

在提交完 Pull Request 的后,在这个 Pull Request 处理期间,由原本的能自动合并变成不能自动合并,这是一件非常正常的事情,那么,这时,我们有两种选择,一种,继续合并到目标,然后手动处理冲突部分,另一种则是先处理冲突,使得该 Pull Request 处于可以自动合并状态,然后采用自动合并,一般来讲,我们官方推荐第二种,即先处理冲突,然后再合并。具体操作为:

先在本地切换到提交 Pull Request 的分支,然后拉取目标分支到本地,这时,会发生冲突,参考如何处理代码冲突这一小节将冲突处理完毕,然后提交到 Pull Request 所在的分支,等待系统后台完成Pull Request的更新后,Pull Request 就变成了可自动合并状态

8、Pull Request 不小心合并了,可否回退

对于错误合并的 Pull Request,我们提供了回退功能,该功能会产生一个回退 XXX 的 Pull Request,接受该 Pull Request 即可完成回退动作,注意,回退本质上是提交一个完全相反的 Pull Request,所以,你仍然需要进行测试来保证完整性,另,为了不破坏其他 Pull Request,建议只有需回退的 Pull Request 处于最后一次合并操作且往上再无提交时执行回退动作,否则请手动处理。

Ideal的Git操作

IDEA查看代码提交信息

1.在使用Git进行代码管理的时候,使用IDEA、PyCharm等编辑器对代码进行编辑时, 有时候想查看代码的提交时间和作者,可以使用IDEA、PyCharm上面的工具方法进行查看;

2.在代码文件内左侧空白区域,右击鼠标,选择注释 “Annotate”:

3.如下显示提交信息,点击任意信息,显示出提交信息的详细信息;

4.也可以在代码文件中右键选择 Git - Annotate 进行查看;

Guess you like

Origin blog.csdn.net/peterjava123/article/details/129378693