[日常技能] Git連接GitHub並上傳文件

本地添加遠程git倉庫

git remote add hello https://github.com/Pretice/Hello-world.git

查看所有分支

git branch -a
/*dev
  master
  test2
  remotes/hello/dev
  remotes/hello/devT
  remotes/hello/master
  remotes/hello/tes
  remotes/hello/test2
  remotes/origin/master
*/

建立本地分支和遠程分支聯繫

git branch --set-upstream-to=hello/test2 test2

更新遠程代碼到本地

git pull
//Already up to date.//已經是最新的了

查看分支狀態

git status
//*On branch test2 //目前分支爲test2
Your branch is up to date with 'hello/test2'. //你的分支是最新的'hello/test2'
*/
nothing to commit, working tree clean //沒有需要commit的文件

在本地添加新文件進行上傳測試

git add -A //添加所有文件
git commit -m "測試提交註釋"
git push //上傳到遠程github倉庫
git pull //獲取最新的文件

git remote //查看遠程的倉庫
git branch -a //查看所有的分支
git checkout [branch] //切換分支
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章