git 安裝
git config --global user.name "yourname"
git config --global user.email "youremail@163.com"
git config --list (查看配置)
git 倉庫
git init ( 生成.git文件)
git add
git add --help (查看幫助文檔 q 退出文檔)
git add -A (提交所有文件)
git reset HEAD demo.txt (從倉庫中移除)
git checkout -- demo.txt (刪除未提交變動)
git commit
git commit -m "commit info"
git status
Git 工做流
git log
git reset --hard 2d62d28ea69a8ed0f69ae3daf0749c0382f2e197
git rm -f test.php
遠程倉庫
ssh-keygen -t rsa -C "youremai@email.com"
cat id_rsa.pub
複製公鑰到github
ssh -T git@github.com (判斷是否設置成功)
git remote add origin git@github.com:youname/youproject.git (設置遠程倉庫)
git pull origin master (拉取遠程內容)
git push -u origin master (推送到遠程倉庫)
克隆倉庫
git clone git地址
分支管理
git branch feature/test1_branch (建立分支feature/test1_branch)
git branch
git checkout master (切換到master分支上)
git branch -d feature/test1_branch (刪除分支)
git merge branch1