網站首頁 學習教育 IT科技 金融知識 旅遊規劃 生活小知識 家鄉美食 養生小知識 健身運動 美容百科 遊戲知識 綜合知識
當前位置:趣知科普吧 > IT科技 > 

git命令詳解|linux

欄目: IT科技 / 發佈於: / 人氣:2.28W

1、git init 初始化

2、git add main.c 將main.c添加到暫存區

3、git commit -m ‘版本資訊說明’ 將暫存區的檔案提交到版本庫裏面

4、git log 檢視日誌資訊

5、git config --global user.name “你的名字”

6、git config --global user.email “你的郵箱

7、git reset --hard HEAD^ 其中“HEAD^” 與 HEAD~1 和用序列號是等價的

8、git reflog 檢視之前操作的資訊

9、git status 檢視工作區狀態

10、git checkout – filename 丟棄修改

11、git reset HEAD filename 從暫存區撤離

12、git rm filename 刪除一個檔案並提交到暫存區

13、git branch 檢視分支

14、git branch 創建分支

15、git checkout 切換分支

16、git checkout -b 創建 切換分支

17、git branch -d 刪除分支

18、git merge 合併某分支到當前分支

19、git log –pretty=oneline 歷史記錄顯示一行

20、git log --graph --pretty=oneline

21、git stash list 列出儲存的工作現場

22、git stash pop 恢復工作現場

23、git merge --no-ff -m ‘描述符 禁用快速合併’

24、生成通信密鑰 方法:ssh-keygen -t rsa -C “[email protected]

25、-t 指定密鑰類型,默認是 rsa ,可以省略。

26、-C 設定註釋文字,比如郵箱。

27、測試 ssh -T [email protected]

28、git clone xiangmudizhi 克隆項目

29、git push origin 分支名 提交分支到 github

30、git push -u origin 分支名 提交分支到 github ,並跟蹤改分支

31、git branch --set-upstream-to=origin/遠程分支名 本地分支名

功能爲:設定本地分支跟蹤服務器分支(待驗證)

32、git pull origin fenzhiming 拉取遠程服務器上的分支 更新到本地

linux git命令詳解

Tags:git 命令 linux