[Git]-How to submit a Pull Request (PR)

How to submit a Pull Request

Here we take Gitee as an example

  1. Create a directory where the project code is placed locally, and then right-click to select git bash. When using it for the first time, you need to configure git: use the git config --global user.name "用户名"configuration user name (that is, the user name on Gitee), and use git config --global user.email "电子邮箱地址"the configuration mailbox (that is, the mailbox bound on Gitee)
  2. Fork the project code from the public warehouse to your own personal warehouse
    fork
  3. Clone the code of the personal warehouse to the local (the directory created in the first step), use the clone git clone 项目代码的地址to operate, and you can see the corresponding project directory locally after cloning
  4. It is recommended to switch to the development branch when developing, use git checkout -b 新分支名create and switch to a new branch (only a suggestion of course)
  5. Make the required modifications to the local project code
  6. Continue working in the bash window. Use git commit -s -ato commit your changes. -s means adding some additional information; -a means adding all the modifications just made to the commit. Information usually contains three parts, title, message, and author information. -s can automatically add author information. After pressing Enter, the submission information editing interface appears. Using the vim editor, you can make modifications and then commit. After completing the commit, you can push it to the remote branch (referring to the personal warehouse)
  7. Use git pushthe command to push, because the submitted branch is the remote master branch, so if you choose to switch to other branches (such as dev) in step 4, that is, branches that are not on the remote warehouse, then the push will fail, and git will prompt Use a --set-upstream option and follow its prompts; and if you do not switch to other branches or use the local master, the direct push will succeed
  8. After pushing, you can see the commit just now in the remote personal repository.
  9. Select pull request in the personal remote repository, and you can see the information of the source branch and destination branch of the PR. After adding the title, description, etc., click Create PR, and we can create a new PR under the public main warehouse. So far, the PR has been submitted successfully and waits for the administrator to review it.

Guess you like

Origin blog.csdn.net/Pacifica_/article/details/124800740