git經常使用命令整理以及詳解

設置Git的user name和email,查看公鑰,生成公鑰

git config --global user.name "test"
git config --global user.email "test@a.com"
cd ~/.ssh
ssh-keygen -t rsa -C "test@a.com"

克隆代碼,拉取更新,添加,提交,推送,拉取更新,切換分支,合併分支

git clone http..xxx.git    //克隆項目
git pull orign master    //拉取主分支最新代碼
git add --all    //添加代碼
git commit -m "desc"    //提交代碼
git push origin master    //代碼推送,主分支
git push origin mybranch    //代碼推送,本身的分支
git checkout -b newbranch    //新建分支
git checkout oldbranch    //切換分支
git branch     //查看當前全部分支
git status     //查看代碼提提交的狀況
git merge origin/otherbranch //將其餘分支合併到當前分支

更多命令,用到再加,哪裏不對的,歡迎勘誤git

相關文章
相關標籤/搜索