git 命令每次都需要輸入密碼
解決方案:
git bash進(jìn)入你的項(xiàng)目目錄,輸入命令
git config --global credential.helper store
代碼回滾
回退命令:
$ git reset --hard HEAD^ 回退到上個(gè)版本
$ git reset --hard HEAD~3 回退到前3次提交之前,以此類推,回退到n次提交之前
$ git reset --hard commit_id 退到/進(jìn)到 指定commit的sha碼
強(qiáng)推到遠(yuǎn)程:
$ git push origin HEAD --force
切換遠(yuǎn)程分支
查看現(xiàn)有遠(yuǎn)程倉(cāng)庫(kù)的地址url
git remote -v
修改命令
git remote set-url origin <URL> 更換遠(yuǎn)程倉(cāng)庫(kù)地址。把<URL>更換為新的url地址。
刪除分支
//刪除遠(yuǎn)程分支
git push origin --delete dev
//刪除本地分支
git branch -d dev
打tag
//打上tag v1.0.0
git tag v1.0.0
// 把tag 推送到遠(yuǎn)端
git push origin v1.0.0
撤銷merge
git merge --abort
git reset --merge
git pull