Git 筆記2 Git 執行上傳到 Github
先定義遠端的名字 將遠端的名字設定為: origin
git remote add origin  git@gith_____________也可以設定別的名字
你可以看看你遠端的名字有誰
git remote -v  git remote 像是我就顯示
SensorHub   
main
origin
 
-假設我們要上傳 Source 這個資料夾
git add  Source 
接下來將 add的提交上去 提交資訊寫一下改了甚麼
git commit -m 提交資訊
如果是主branch 就是main
git branch -M  main
但是如果是修改不蓋掉主分支  建議改個 branch  舉例 test_branch_1
git branch -M  test_branch_1
在這裡我還是會看一下遠端有甚麼
git remote -v 顯示
SensorHub git@github.com……….
main git@github.com……….
origin git@github.com……….
我要改的是 SensorHub那就
git push -u SensorHub test_branch_1其中 SensorHub 是remote  遠端的代稱
test_branch_1 是分支的名稱
如果推不上去就用
git push -f SensorHub test_branch_1