当前位置:网站首页>Git code submission operation, and git push prompt failed to push some refs'xxx '

Git code submission operation, and git push prompt failed to push some refs'xxx '

2020-11-07 20:19:00 Jiang Feng sleeps in sorrow

1.   New empty folder , stay git bash Execute the following command in , The drop-down git The latest code ;
git clone https://xx,
If it's just updating code , execute git pull Equivalent to downloading remote code to local , Merge with your local code  
git pull
 
2.    View local code status , Whether the code to be submitted , Red font shows the modified file ( To be submitted )   
git status
 
3. Submit code to local git Buffer zone :
   According to the single document or all the documents submitted , It is divided into two ways of submission
    1)git  add .   Submit all local code  
    2)git add xxx( Red file link )
 
 
4. Submit code to local git library :git commit -m " Code submission "   Add comments for this submission    
git commit -m " Code submission "
 
5. hold git The code for the local warehouse is submitted to a branch of the remote host
  • git push < Remote host name > < Remote branch name >:
    git push origin master

  git push Tips failed to push some refs"XXX"

   Push code error, The reason for the mistake is github Medium README.md The file is not in the local code directory . Obviously , This is because the remote library is not consistent with the local library ,

That is to say, we need to put any file in the remote code base first pull Go to the local code base , can push New code to github In the code base , Next, you can synchronize the remote library to local

6. Resolve conflicts : 
git pull --rebase origin master
  •   This instruction means to merge updates from remote warehouses into local libraries ,–rebase The purpose of this is to cancel the local library commit, And received in the new edition of the library , After the After executing the above code, you can see that there are many in the local code base README.md file   

7. Push the submitted code to the main branch   

git push -u origin master 

版权声明
本文为[Jiang Feng sleeps in sorrow]所创,转载请带上原文链接,感谢