git本地倉庫和遠程倉庫關聯


1、創建遠程倉庫

2、初始化本地倉庫git init     git add .     git commit  -m "desc"

3、關聯遠程倉庫  git remote add origin https://github.com/fatedier/frp.git

4、第一次先拉取遠程庫中的README.md和.gitignore等文件     git pull origin master

5、查詢代碼拉取是否成功   git status

6、查詢本地分支git branch -a

7、提交本地代碼git push 或者git push origin master或者$git pull origin master --allow-unrelated-histories

 

8、刪除遠程分支:git push origin --delete  v2

 

9、本地代碼,已經關聯了遠程分支,先解除關聯:git remote remove origin

解除后、重新關聯新的遠程分支,並將代碼傳上去

10、報錯:

needs merge
error: you need to resolve your current index first

解決:

git reset --merge  #回退到merge前

11、分支重命名

git branch -m oldName newName
git push --delete origin oldName
git push origin newName
git branch --set-upstream-to origin/newName

12、輸入“git remote -v”查看項目遠程地址

13、輸入“git log”查看歷史提交信息。

14 、查看某次commit中具體某個文件的修改:
git show commitId fileName




 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM