实际应用中git(合并本地与服务器项目)
在服務器直接操作后 本地要做合并操作? 否則push會報錯誤
$ 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、(先進入項目文件夾)通過命令 git init 把這個目錄變成git可以管理的倉庫
git init2、把文件添加到版本庫中,使用命令 git add .添加到暫存區里面去,不要忘記后面的小數點“.”,意為添加文件夾下的所有文件
git add .3、用命令 git commit告訴Git,把文件提交到倉庫。引號內為提交說明
git commit -m 'first commit'4、關聯到遠程庫
git remote add origin 你的遠程庫地址如:
git remote add origin https://github.com/cade8800/ionic-demo.git5、獲取遠程庫與本地同步合并(如果遠程庫不為空必須做這一步,否則后面的提交會失敗)
git pull --rebase origin master6、把本地庫的內容推送到遠程,使用 git push命令,實際上是把當前分支master推送到遠程。執行此命令后會要求輸入用戶名、密碼,驗證通過后即開始上傳。
git push -u origin master*、狀態查詢命令
git status備:詳細請參考?http://www.cnblogs.com/tugenhua0707/p/4050072.html
?
?
轉載于:https://www.cnblogs.com/zhang-bin/p/9772454.html
總結
以上是生活随笔為你收集整理的实际应用中git(合并本地与服务器项目)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ASP.Net MVC 在ajax接收c
- 下一篇: 科学家研发机器人混入南极企鹅群 获“友好