背景:
总结项目中经常用到的git命令,方便查找
推荐一个学习git的网站:
https://learngitbranching.js.org/?locale=zh_CN
从指定版本新建分支
git checkout -b new-branch 780e2a7fc714faf388ba71
删除分支
git branch -d branhch-name
注意当前不能处于要被删除的分支上
将当前分支重命名为main
git branch -M main
git放弃未放到暂存区的修改
git checkout .
配置 Git 仓库的设置。
当使用 global 选项时,这些设置将应用于你的用户账户在所有 Git 仓库中的操作。
git config --global user.name "XXXX"
git config --global user.email "XXXX@XXX"
查看历史提交
git log
按q键退出
查看远程仓库地址
git remote -v