-查看全局配置:git config --list
-设置用户信息:git config --global user.name “zhangsan” / git config --global user.email “123@XX.com”
-初始化本地git仓库:git init (在相应的文件夹下打开Git Bash)
-获取远程git仓库:git clone +远程仓库SSH地址
-提交代码到暂存区:git add * / git add +文件名
-查看文件状态: git status
-取消暂存 / 恢复到指定版本:git reset +指定文件名 / git reset --hard +commit标识符
-将代码从暂存区存到本地仓库:git commit -m “message” +文件名
-查看日志信息:git log
-查看远程仓库:git remote
-查看远程仓库地址:git remote -v
-添加远程仓库:git remote add origin +远程仓库SSH地址
-克隆远程仓库:git clone +远程仓库HTTPS地址
-推送到远程仓库(必须先添加到本地仓库):git push origin master (其中origin为远程仓库别名,master为分支)
-拉取远程仓库:git pull origin master / git pull origin master --allow-unrelated-histories (解决合并错误)
-查看分支:git branch / git branch -r / git branch -a
-创建分支:git branch branchname
-切换分支:git checkout branchname
-分支推送:git push origin branchname
-分支合并:git merge branchname
-解决分支合并冲突:需要手动修改冲突文件,并提交。
标签:记录当前分支下的状态。
-查看标签:git tag
-添加标签:git tag tagname
-推送标签至远程仓库:git push origin tagname
-检出标签至分支:git checkout -b branchname tagname



