Linux Git常用 操作命令

【Git Commond】

1.git checkout 查看本地所有修改
2.git checkout -- 文件路徑 丟棄當前選中文件
3.git checkout . 丟棄本地所有修改
4.git branch 查看本地分支
5.git checkout master 切換到master分支
6.git branch -D hongchangfirst 刪除本地某個分支
7.git add file 暫存文件
8.git commit -m “message” 提交的是暫存文件
9.git log --author=“author” 查看某個人所有提交
10.撤銷git pull
(1)執行git reflog獲取你自己的commit id
(2)git reset –hard id(id 爲當時提交的commit id)
11.合併A分支的提交到另B分支
(1)git log --author=“author”獲取你在A分支的提交記錄並記錄commit id
(2)git checkout B 切換到B分支
(3)git cherry-pick id,將A分支爲id的commit提交到B分支

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