Native code submitted to a remote repository:
Set git user name, e-mail
git config --global user.name xxx git user namegit config --global user.email xxx git-mail
The project submitted to the main branch (master):
git remote rm origin delete an existing remote connectiongit init initialize the local warehousetouch README.md create README.md filegit add. Add the modified files to the staginggit commit -m "first commit" will be submitted to the temporary files to the local current branchgit remote add origin https: //xxxxxxx.xx/xx/ local warehouse connect to a remote repositorygit push -u origin master will push the local repository file to the remote master branch
The main branch code to pull dev branch:
git branch -a view of all remote branchgit checkout -b dev origin / dev create dev branch and remote branch dev update to the local branch localgit pull origin master --allow-unrelated-histories to update the master branch of the current branch(Execute git pull origin master error is thrown refusing to merge unrelated histories)
Error Resolution:
command:git push origin masterfailed to push some refs to 'https://github.com/CrazyDony/text.git'hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Integrate the remote changes (e.g.hint: 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The reason: he is older than the main branch version
solve:
git push -u origin master-fCounting objects: 35, done.Delta compression using up to 4 threads.Compressing objects: 100% (29/29), done.Writing objects: 100% (35/35), 10.15 KiB | 0 bytes/s, done.Total 35 (delta 5), reused 0 (delta 0)To https://github.com/CrazyDony/text.git+ aa70966...f64b22a master -> master (forced update)Branch master set up to track remote branch master from origin. 完成
Branches merge:
The dev branches merged into the master branch:
git checkout mastergit go dev