Git 常用操作
克隆仓库:
git clone https://github.com/xxx.git创建分支:
git branch [name]切换分支:
git checkout [name]检出分支:
git checkout -b [name]新增远程分支:
git push --set-upstream origin xxx抓取远程分支:
git fetch origin [name]同步远程分支:
git pull origin [name]删除本地分支:
git branch -d [name]删除远程分支:
git push origin --delete [name]查看远程仓库地址:
git remote -v添加远程仓库:
git remote add origin https://github.com/xxx/xxx.git抓取远程仓库:
git fetch [remote-name]同步远程仓库:
git pull [remote-name]查看标签:
git tag添加用户:
git config --global user.name注销用户:
git config --global --unset user.name初始化本地库:
git init发布新建的本地分支到远程分支:
git push -u origin xxx更新远程分支列表:
git remote update origin --prune放弃已追踪的某个文件:
git update-index --assume-unchanged filename撤销放弃已追踪的某个文件:
git update-index --no-assume-unchanged filename关闭大小写不敏感:
git config core.ignorecase false放弃已被追踪的某个目录:
git rm -r --cached docs/.vitepress/cache
默认配置文件位置
macos 系统中:~/.gitconfig