GIT简介
1.git组成及常用命令说明
常用命令
1.切换远程地址
git remote set-url origin <新地址>
2.删除缓存区文件
git rm -r --cache <目录>(例如:../.idea/)
git rm --cache <文件>
git restore --staged <文件>
3.查看状态
git status
4.切换HEAD位置
## 查看所有日志
git log <-5>
## 其中<-5>表示5条
## 查看所有日志
git reflog
## 重新设置HEAD标位置
git reset <--soft/mixed/hard> <logid>
## 其中<--soft/mixed/hard>为合并类型,soft为只切换本地仓库,mixed切换本地仓库和暂存区,hard切换本地仓库+暂存区+工作空间,这里默认为mixed
## <logid> 为日志id
## 某些本地commit不想push到远程仓库的时候可以使用reset切换到commit之前重新操作。
异常提示处理:
1./dev/tty 提示
git提示异常内容如下
error: unable to read askpass response from 'C:\Users\Administrator\AppData\Local\JetBrains\IntelliJIdea2021.3\tmp\intellij-git-askpass-local.sh'
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'http://10.20.99.20:4889': No such file or directory
修改git远程地址,改为在地址前添加用户名和密码,样式如下:
http://tianqiuhao:tqh123456@xxx.xxx.xxx.xxx:pppp/xxx.git