Submit supplementary (pr) tutorials for github projects

submit pr

foreword

Vue框架:Learn from the project Vue
OJ算法系列:magical machine hundreds of refining - algorithm detailed explanation
Linux操作系统:of Fenghou Qimen - linux
C++11:Tongtianlu - C++11
Python常用模块:Tongtianlu - Python

Submit supplements for github

What is PR:

"PR" is an acronym for Pull Request.
In open source software development, a Pull Request means pushing your changes into an open source project's code base and requesting that the project's maintainers review and accept your changes.

Fork:

  • Click the Fork fork icon in the upper right corner of the project homepage to copy the project to your own github repository:Fork

  • Note that by default, only the default branch file of the project is copied to the new warehouse. To copy all projects, cancel √:
    main branch

git clone own warehouse:

  • Enter the Fork project from your own warehouse, and find that the web page routing and Git routing have been changed to the path under your own name:
    fork

  • Open a folder in vscode that is ready to store the project, Ctrl + , open the console, and execute the clone command:

git clone 上图code按钮下的HTTPS链接或者SSH链接

clone

  • After the clone is successful, there will be one more project folder under the folder, and you can view more information after entering:
cd 目标文件夹              《用于进入目标文件夹》
git status               《查看当前项目改动情况,以及目前所在分支》
git branch -a            《查看所有分支》

Branch corresponds to this button on the web page:
branch

git remote add upstream establishes a relationship with other warehouses:

  • Use git remote -v to view the relationship between the current local folder and the git warehouse: currently associated with your own warehouse
    insert image description here
  • Use git remote add upstream to associate the original project URL with the original project
    • The original project URL is under the code button of the original project:
      code
    • If git remote add upstream wrong URL, you can use git remote rm upstream to unlink
    • After the association is successful, it can be seen that origin and upstream have different sources

git checkout branch name switch branch:

  • It is likely that the code to be modified is not in the default branch, you need to git checkout to switch branches first:
    • Notice! Do not use it! Do not use it! Do not use it! git checkout -b, because -b is a new branch.
      checkout

Start DIY project file:

  • At this time, the project codes to be DIY are all in the file list on the left side of Vscode, and can be added, deleted or modified at will:
    modify the code

Push changes to your warehouse:

  • You can directly branch in the master, or you can create a new branch to push.
    • If git log finds only (Head), no (Head -> local branch, cloud branch)
    • Timely checkout is required to connect to the target branch:
git checkout -b lab4 origin/lab4
本地创建一个lab4分支,和自己云端仓库lab4关联,切换到这个本地仓库

insert image description here

  • After the modification is complete, use git status to view the modified content:
    git status
  • Use git add . + git commit -m "commit instructions" to submit the modification to the transfer station:
    add.
  • Use the git push origin target branch name to submit the modification from the transfer to the origin warehouse:
    • All branch names are viewed through git branch -a
      git push origin

Empty Head problem:

  • After git add, git commit and git push, I found that my web warehouse has not changed, which is probably the git Head pointer mentioned above

cherry pick:

  1. git log records the commit number, there are multiple commits
  2. Switch to the local branch associated with the target push to the remote branch. After the switch, the git log finds (Head -> local branch, cloud branch)
  3. git cherry-pick commit number 1 commit number 2 commit number 3 ..., separate commit numbers by spaces
  4. After success, git push origin target branch again

git reset:

  1. If cherry-pick has the wrong commit number, you can git cherry-pick --abort, and then git log finds that the pick number is gone
  2. You can retrieve all lost commit numbers through the latest commit number in the first step of git reset
  3. git log to check whether there is a target commit number, if so, continue to git push origin target branch

Push completed, submit PR:

  • After a successful push, there is a prompt on the webpage:
    push
  • Click Compare & pull request to view the PR content.
    PR
  • You can create a pull request to initiate a PR request, or you can create a draft pull request to keep only the draft.
    create PR

Modify the PR:

  • After submitting to the source project, there will be a review to provide revision opinions, generally according to the line unit:
    +
  • You only need to make changes locally, git add + commit + push, and the PR will be modified accordingly.

postscript:

  • Thanks to Li Hongyu, the teacher of the OS class, for answering my questions about TLSF memory management, and patiently solving many git idiot problems I encountered. I wish you all the best.
  • The Rust real-time operating system experiment is very valuable. I implemented a malloc and free by myself, and learned a lot about low-level memory management. It is wonderful as the end of the May Day holiday.
  • I am very excited to submit a PR to an open source project for the first time.

Guess you like

Origin blog.csdn.net/buptsd/article/details/130603050