git常用命令
git add . 添加项目至缓存区
git commit -m ""
git push 推送
git config --global(全局配置) user.name 查看用户名
git config --global(全局配置) user.email 查看邮箱
git config --list 查看配置信息
git status 查看状态
git push origin branch-name 向指定分支推送
生成秘钥:ssh-keygen -t rsa -C "your_email@youremail.com"
git clone -b dev xxx.git // -b 分支名 拉取指定分支的代码
git fetch origin 远程分支名x:本地分支名x // 以远程分支创建新分支
git stash
git stash list
git stash pop
分支操作
创建分支的步骤
git branch xxx 创建分支
git checkout xxx 切换分支
git switch xxx 切换分支
git checkout -b 创建并切换分支 === git branch + git checkout
git add .
git commit -m ''
git push origin branch-name
git 合并分支的步骤
git add .
git commit -m "" //合并前必须先 commit 修改代码
git switch xxx //切换到要合并的目标分支
git merage xxx // 合并指定分支名到当前分支git merge 会默认 commit 即merge之后不需要add commit操作
git pull // 拉取代码修改到本地 === git fetch + git merge 同merge 会默认commit
git push //推送
删除分支
git branch -d xxx //删除分支