Source:
Disclaimer: If I violate anyone's rights, please contact me and I will delete it.
Welcome experts to spray me
Article Directory
-
-
-
-
- I used the master branch to upload files before, but I was asked to compare & pullrequest. Where can the master merge? ! Later, I found out that there was already a branch of main. From then on, the master was just a little brother. The most terrible thing was that the master merged with the main. !
- Either submit directly with the main branch, or create a sub-branch dev and merge into the main after submission
-
-
-
I used the master branch to upload files before, but I was asked to compare & pullrequest. Where can the master merge? ! Later, I found out that there was already a branch of main. From then on, the master was just a little brother. The most terrible thing was that the master merged with the main. !
Related operations without merging
Either submit directly with the main branch, or create a sub-branch dev and merge into the main after submission
main branch commit
1.git checkout -b main Create the main branch and enter:
2.git branch -D master delete the local master branch
First use git branch to see which branches are there:
After deleting:
3.git push origin --delete master delete the master branch on the github project:
after deletion:
4.git push -u origin main: push code
Updates were rejected because the tip of your current branch is behind错误:
You should git pull first: git pull origin main
has version conflict again,
then use
git pull origin main --allow-unrelated-histories
to execute git push origin main
successfully! ! !