常用git命令

git remote -v  #查看遠程倉庫:
git pull origin master  #把遠程倉庫 master 與本地當前分支合併

git branch yuzhong_20181121 #創建分支yuzhong_20181121
git checkout yuzhong_20181121 #切換到分支yuzhong_20181121

git add “”#添加文件到當前本地分支
git commit -m "branch test"  #提交修改

git checkout master #切換到本地master分支
git merge yuzhong_20181121 #把本地的分支yuzhong_20181121 合併到當前的本地master

git push origin yuzhong_20181121 # 把本地分支推給遠程倉庫 orgin
git push origin master # 把本地master分支推給遠程倉庫 orgin

git reset --hard FETCH_HEAD #把本地的衝突文件沖掉,放棄所有修改。
git pull #更新代碼

git status #查看當前分支修改狀態

git checkout -- test.txt #誤刪除文件後,從版本庫恢復此文件

從版本庫中刪除文件
rm test.txt #先刪除文件
git rm test.txt #從版本庫中刪除
git commit -m "remove test.txt" #提交刪除操作
git push origin master#推送修改

 

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