git中的選項解釋
-d --delete:刪除
-D --delete --force的快捷鍵
-f --force:強制
-m --move:移動或重命名
-M --move --force的快捷鍵
-r --remote:遠(yuǎn)程
-a --all:所有
創(chuàng)建本地git倉庫
git init
提交代碼到git倉庫
git add .
git commit -m"提交說明"
本地git倉庫添加到遠(yuǎn)程倉庫中
git remote add origin gitSSH
克隆遠(yuǎn)程倉庫到本地
git clone SSH
拉取遠(yuǎn)程分支到本地彪腔,并創(chuàng)建分支
git checkout -b 本地分支名 origin/遠(yuǎn)程分支名
拉取遠(yuǎn)程倉庫數(shù)據(jù)进栽,保留本地,替換遠(yuǎn)程
git pull origin master --allow-unrelated-histories
創(chuàng)建并切換到對應(yīng)的分支
git checkout -b branchName
本地分支與遠(yuǎn)程分支關(guān)聯(lián)
git branch --set-upstream-to=origin/<branch> dev
查看本地分支
git branch
查看遠(yuǎn)程分支
git branch -r
查看全部分支
git branch -a
刪除本地分支
git branch -d <branchname>
git branch -D <branchname>(強制刪除)
刪除遠(yuǎn)程分支
git branch -d -r <branchname>(本地分支名)
git push origin :<branchname>(推送到遠(yuǎn)程分支)
合并分支
git merge <branchname>
修改遠(yuǎn)程倉庫地址
git remote -v 顯示當(dāng)前的地址
git remote set-url origin https://github.com/youname/warehousename.git
git push -u origin master
強制推送到遠(yuǎn)程倉庫格嗅,且遠(yuǎn)程和本地關(guān)聯(lián)
git push -u origin master -f
git tag屯掖,打上標(biāo)簽
創(chuàng)建標(biāo)簽
git tag -a <版本號> -m "<備注信息>"
推送所有標(biāo)簽
git push origin --tags
刪除本地標(biāo)簽
git tag -d <版本號>
刪除遠(yuǎn)程標(biāo)簽
git push origin --delete <版本號>
Warning: the ECDSA host key for 'myserver' differs from the key for the IP address '192.168.1.81
ssh-keygen -R 192.168.1.81