通過 git 將本地項目代碼上傳到 Coding

直接上步驟:

1、在 coding 上創建項目並初始化( 可以選擇使用README 初始化);

2、初始化本地倉庫:在本地代碼文件夾中用 git bash 運行命令:git init  ;

3、關聯地址:git remote add origin 地址(地址爲創建好的項目的 SSH 地址);

4、執行 git pull origin master 命令,將初始化的 readme 文件拉下來;

5、添加文件到倉庫緩存區:git add .

6、添加提交說明:git commit -m "提交說明" ;

7、執行 git push origin master 命令,即可將本地代碼上傳到建好的 coding 項目;

後續再提交,只需要按順序執行以下常規操作即可:

git add .

git commit -m '提交說明'

git pull origin master

git push origin master

其他 git 命令:
git diff 查看具體修改內容
git log 查看歷史提交記錄 鍵盤英文狀態下按字母 q,退出 git log
git status 隨時查看工作目錄的狀態
git clone '地址' 下拉到本地
git add 文件名 把文件添加到暫存區
git push -u origin brnach_name 提交到相應分支
git branch 查看所有分支
git branch branch_name 創建分支 branch_name
git checkout branch_name 切換分支
git checkout -b branch_name 創建分支並自動切換到該分支上
git branch -d branch_name 刪除分支(需要合併分支的指令)
git brnach -D branch_name 刪除分支(無需合併分支的指令)
git merge branch_name 合併分支
git rm --cached FILENAME 刪除 git 的文件跟蹤緩存
git checkout master 切換到 master 分支
git merge a b c 合併 a、b 和 c 分支
git status -s 查看文件是否被過濾
git rm --cached files-you-want-to-ignore 忽略已經提交的文件

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章