1. 程式人生 > >git idea 初始化專案

git idea 初始化專案

3.git status 檢視git狀態,git add .新增新增修改的檔案


4.再git status 檢視新增的檔案


5.git commit -am "first commit init project" 提交修改的檔案到本地庫


6.把專案push到遠端倉庫
git remote add origin https://gitee.com/xxx.git


7.檢視分支git branch


第一次推送報錯
推送遠端git push -u origin master
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/liziming/mmail.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.


錯誤解決:先執行git pull


再執行:提示當前分支落後遠端版本
git push -u origin master
To https://gitee.com/liziming/mmail.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/liziming/mmail.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: 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.


8.強制推送 git push -u -f  origin master


9.git branch 檢視本地分支 git branch -r 檢視遠端分支


10.新建遠端分支,從主分支中新建v1.0分支
git checkout -b v1.0 origin/master
Branch v1.0 set up to track remote branch master from origin.
Switched to a new branch 'v1.0'


提示本已經切換到v1.0分支


11.把分支推送到遠端git push origin HEAD -u

三:修改提交程式碼
1.git status 檢視本地 修改狀態
2.git add . 新增修改的檔案 git status
3.git commit -am 'modify commit' -a 提交 m 提交說明
4.提交遠端 git push 
檢視分支 git branch