Git 常用命令、代码合并

1.合并代码提示含义

Accept Current  Change  接受其他分支的内容
Accept Incoming Change  接受该分支的代码
Accept Both Change      接受两个代码
Compare Changes         比较更改

2.git常用命令

修改提交错误 commit 备注
git commit --amend -m "初次提交"
删除远程地址
git remote rm origin
查看远程地址
git remote -v
查看历史版本
git log
git log --oneline
查看命令历史
git reflog
查看分支
git branch
git branch -a
切换分支
git checkout -b 分支名
合并分支
git checkout xxx   // 切换到主分支
git merge xy-xxx   // 合并分支
删除分支
git push origin --delete branch // 删除远程分支
git branch -d branch // 删除本地分支
关联分支
git branch --set-upstream-to=origin/远程分支名 本地分支名
查看关联状态
git branch -vv
回到指定版本
git reset --hard 版本号
撤销提交代码
git reset --mixed(默认) commitID   撤销git commit,撒销git add,保留编辑器改动代码
git reset --soft commitID         撤销git commit,不撤销git add,保留编辑器改动代码
git reset --hard commit1D        撤销git commit,撒销git add,删除编辑器改动代码
合并分支部分文件
git checkout B			// 1.切换到 B 分支
git checkout A a b		// 2.从 A 中抽取 a、b 两个选定的文件
posted @ 2022-12-06 22:19  轻风细雨_林木木  阅读(192)  评论(0编辑  收藏  举报