GitHub-常用命令(個人使用)

git --version---檢查是否安裝成功

git status--查看文件是否更改

git clone --克隆代碼

git add .----添加已經更改所有文件

git commit -m "test"---提交

git pull -拉取代碼

git branch--查看本地分支

git branch -a--查看遠端分支

git checkout -b branch1--創建本地分支

git push --set-upstream origin branch1---提交代碼到分支上

git branch -d branch1--刪除本地分支

git branch -d branch1--強制刪除本地分支

git branch -r -d origin/branch1---刪除遠端分支(此命令結合下方提交操作,不然遠端不會刪除掉分支)

git push origin :branch1--提交刪除遠端分支操作(origin後面是有空格的---注意)

git checkout  分支名稱--切換分支

git merage  分支名稱--合併分支

git reset --head HEAD^--回退到上一版本(回退前二個版本時^^代表二次)

git reset --head HEAD~2--回退到前二個版本(2代表回退版本次數)

git reflog---(得出版本加密號,結合下方命令使用,回退到指定版本號)

git reset --hard xxxx(xxxxx版本加密號)--通過git reflog可以查看每個版本對應的加密號

 

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