好久没写总结了,有时候时间久了就忘了自己都碰到的问题及解决办法
前期配置
git 初始化配置
- git config --global user.name
- git config --global user.email
查看所有配置信息
- git config --list
对应流程
- 先克隆代码git clone https
- 创建自己的分支,并切换分支 git checkout -b name
- 在自己的分支上开发代码
- git add .
- git commit -m ‘提交注释’
- git push origin 分支名
- git mergin
提交代码中:
合并commit
git checkout 主分支
git pull 更新代码
git checkout 自己分支
git rebase -i 主分支
git push origin 自己分支
git rebase -i 主分支时
遇到冲突,解决冲突,然后add,继续git rebase --continue
遇到冲突,不想解决冲突 git rebase --abort
不想提交代码,保存在当前分支,git stash暂存当前工作
常用命令
git stash list 查看stash记录
git stash save ‘备注’ 保存代码至队列
git stash pop stash@{i} 使用某个stash代码,并移除对应的stash
git stash apply stash@{i} 使用某个stash代码,不移除对应的stash
git stash drop stash@{i} 移除某个stash
git stash clear 删除所有的暂存
git stash show 查看具体的记录
晚上下雨,躺在暖和的被窝里玩着电脑真爽
git log查看提交记录
git log --oneline 查看历史提交记录
git reset --soft commitId 回退commit
git reset --hard commitId 回退commit