標籤:http 建立 狀態 head git安裝 參數 ssh git merge pre
git安裝
- https://git-scm.com/downloads
- 配置使用者資訊
git config --global user.name "xxx" git config --global user.email "[email protected]"
git config --list //查看參數配置資訊
SourceTree的安裝git倉庫
git init
git add
git commit
git commit -m "desc"
git status
ls -a 可以查看隱藏的檔案目錄
git 工作流程
從暫存區回退到工作區
git reset HEAD xxx.txt
git checkout -- xx.txt
git log 找到提交版本號碼
git reset --hard 版本號碼 回退
遠程倉庫
建立SSH key
ssh-keygen -t rsa -C "[email protected]"
個人使用者目錄下 .ssh目錄下 id_rsa.pub內容複寫到github 的key中
添加遠程倉庫
git remote add origin [email protected]:xxx/xxx/git
git push origin master
git push -u origin master
git push origin master
標籤管理
git tag 查看所有標籤
git tag tagname 建立標籤
git tag -a tagname -m "common" 指定提交資訊
git tag -d tagname 刪除標籤
git push origin tagname 推送標籤/標籤發布
git分支管理
git branch查看分支
git branch branch_name 建立分支
git checkout branch_name切換分支
合并分支
- 切換到master分支
git checkout master
- 合并
git merge branch_name
git學習-來自慕課網