1、 回退上一版本
$ git reset --hard
2、 恢復到歷史版本
$ git reset --hard fae6966548e3ae76cfa7f38a461c438cf75ba965
3、 把修改推到遠程服務器
$ git push -f -u origin master
4、創建標籤:
$ git tag -a V1.2 -m 'WebSite version 1.2'
5、查看標籤:
$ git tag
$ git show V1.2 (要顯示附註信息)
6、tag 遠程推送:
$git push origin --tags
7、tag刪除了本地 V1.2的版本
$git tag -d V1.2
8、查看項目的分支們(包括本地和遠程)
$ git branch -a
9、刪除本地分支
$ git branch -d <BranchName>
10、tag獲取遠程版本:
$git fetch origin tag V1.2
11、刪除遠程分支
$ git push origin --delete <BranchName>
12、創建本地分支(修復bug、開發新功能可以新建並切換到新分支進行,最後再合併master)
$ git branch 分支名
13、創建本地切換
$ git checkout 分支名
14.推本地分支到服務器
$git push origin 分支名
15、git合併分支(必須切換到當前分支,merge要合併的分支到當前分支)
$ git merge master
16、git切換到tag (tag是除了方便運維拉版本還有封版作用)
$ git checkout v0.1.0