How to create a branch in a GitHub project? It's actually very simple, just click on Branch, then add your own Branch Name in the pop-up text box, and then click on the blue Create branch. In this way, your project will have 2 branches (master and reademe- edits).
Note: From the above flow chart of branch merging, it can be found that a library can have multiple branches for parallel development, but only one will be merged in the end, so when a branch is merged into the master branch, other The commits of the parallel branches will be regarded as conflicts. The only way to resolve this conflict is to remember to update the repository before making changes so that your branch is consistent with the master branch.
Specific steps:
1. Upload an independent branch (for example, the code is directly DOWNLOAD ZIP file from the project, such as BowlingScore-test.zip, which is independent of the original MASTER branch)
1. Git init (in the local project directory), generate a .git folder
Git init
- 1
2. Upload the modified file
git add *
- 1
git commit -m "test"
- 1
4. (create branch)
git branch test
- 1
5. (Switch branch)
git checkout test
- 1
6. Associate with remote branches
git remote add origin https://github.com/yangxiaoyan20/BowlingScore.git
- 1
7. (Upload the branch)
git push origin test
- 1
Note: Prompt "Please enter github username and password"
2. Upload a branch related to MASTER (this branch is obtained from git clone in MASTER, and the relevant information is in the .git file)
After modifying the source code, perform the following operations
1、git add .
2、git commit -m "test" (”test“为分支名)
3、git branch test(创建分支)
4、git checkout test (切换分支)
5、git push origin test:test
Reprinted from: https://blog.csdn.net/qq_27437967/article/details/71189571
http://blog.sina.com.cn/s/blog_1487b6f6d0102wgtc.html