git使用基本技巧
git 基本配置
提交做文件過濾
- touch ~/.gitignore_global
- 編輯文件,添加不要git進行管理的文件
- 文件主要是一些IDE或者系統的配置文件比如.classpath .project .iml .DS_STORE
- git config --global core.excludesfile ~/.gitignore_global
參考 gitignore文件 gitignore_global
用戶名和郵箱配置
git config --global user.name "liutuanwang"
git config --global user.email "[email protected]"
git 常用命令
1.git status #查看當前分支狀態
2.git log | git log --pretty # 查看提交記錄
3.git checkout # 檢出/創建分支, 檢出文件
4.git stash #緩存本地修改
5.git fetch | pull # 拉取遠程提交
6.git diff | 比較
7.git rebase | 這個比較複雜,用處很大
8.git merge | 合併分支
9.git push | push 到遠程
git help
help 是git的幫助文檔,可以查看具體的命令以及使用方式,使用方式爲 git help tag
git tag
tag 用來打標籤,一般一個大的版本改動之後,需要建立一次標籤,標籤可以用於以後的版本回滾,和發佈分析等
使用方式:
git tag | 列出所有的tag
git tag -l |列出制定tag
git show tag_name | tag內容git push origin tag_name | 本地tag push到遠程倉庫 git tag -a -m 'OSS遷移的代碼' v_20160726_oss