实际应用中git(合并本地与服务器项目)
在服務(wù)器直接操作后 本地要做合并操作? 否則push會(huì)報(bào)錯(cuò)誤
$ git push
To https://gitee.com/zdbgit/2048.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://zdbgit:wmzyq2013@gitee.com/zdbgit/2048.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
?
1、(先進(jìn)入項(xiàng)目文件夾)通過(guò)命令 git init 把這個(gè)目錄變成git可以管理的倉(cāng)庫(kù)
git init2、把文件添加到版本庫(kù)中,使用命令 git add .添加到暫存區(qū)里面去,不要忘記后面的小數(shù)點(diǎn)“.”,意為添加文件夾下的所有文件
git add .3、用命令 git commit告訴Git,把文件提交到倉(cāng)庫(kù)。引號(hào)內(nèi)為提交說(shuō)明
git commit -m 'first commit'4、關(guān)聯(lián)到遠(yuǎn)程庫(kù)
git remote add origin 你的遠(yuǎn)程庫(kù)地址如:
git remote add origin https://github.com/cade8800/ionic-demo.git5、獲取遠(yuǎn)程庫(kù)與本地同步合并(如果遠(yuǎn)程庫(kù)不為空必須做這一步,否則后面的提交會(huì)失敗)
git pull --rebase origin master6、把本地庫(kù)的內(nèi)容推送到遠(yuǎn)程,使用 git push命令,實(shí)際上是把當(dāng)前分支master推送到遠(yuǎn)程。執(zhí)行此命令后會(huì)要求輸入用戶名、密碼,驗(yàn)證通過(guò)后即開(kāi)始上傳。
git push -u origin master*、狀態(tài)查詢命令
git status備:詳細(xì)請(qǐng)參考?http://www.cnblogs.com/tugenhua0707/p/4050072.html
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/zhang-bin/p/9772454.html
總結(jié)
以上是生活随笔為你收集整理的实际应用中git(合并本地与服务器项目)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: ASP.Net MVC 在ajax接收c
- 下一篇: python——logging模块