Git 基础| 青训营笔记

84 阅读1分钟

这是我参与「第三届青训营 -后端场」笔记创作活动的的第3篇笔记。
tree git -- 显示git repo中的文件

git config
git config -- global user.name "usrname"
git config -- global user.email "usrEmail"

命名别名设置
git config --global alias.aliasName "aliasCommand"

查看remote
git remote -v

添加remote git remote add origin_ssh <url>
git remote add origin_http <url>

git add 文件加入暂存区
git commit -m "msg" 文件上传
git checkout -b test 创建新分支\

commit --amend 修改最近一次commit信息
git rebase -i HEAD~3实现对最近三个commit的修改
git reflog export --expire-now --all 记录操作日志过期时间
git gc --prune=now 做garbage collection过期时间为now

代码合并 fast-forward 不会产生merge节点,合并后保持一个线性历史 three-way merge 三方合并会产生一个新的merge节点