Record the first submission of 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:
-
Note that by default, only the default branch file of the project is copied to the new warehouse. To copy all projects, cancel √:
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:
-
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链接
- 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:
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
- 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:
- 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
- The original project URL is under the code button of the original project:
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.
- Notice! Do not use it! Do not use it! Do not use it! git checkout -b, because -b is a new branch.
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:
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关联,切换到这个本地仓库
- After the modification is complete, use git status to view the modified content:
- Use git add . + git commit -m "commit instructions" to submit the modification to the transfer station:
- 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
- All branch names are viewed through git branch -a
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:
- git log records the commit number, there are multiple commits
- 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)
- git cherry-pick commit number 1 commit number 2 commit number 3 ..., separate commit numbers by spaces
- After success, git push origin target branch again
git reset:
- 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
- You can retrieve all lost commit numbers through the latest commit number in the first step of git reset
- 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:
- Click Compare & pull request to view the PR content.
- You can create a pull request to initiate a PR request, or you can create a draft pull request to keep only the draft.
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.