git pull --rebase

简介:

有的同学在使用 git 时会不小心本地分支merge了远端的公共分支(通过 git pull ),我找了篇文章帮助大家学会 pull 的时候直接 rebase

http://gitready.com/advanced/2009/02/11/pull-with-rebase.html

其实很简单,对应的命令行是:

git pull --rebase <remote name> <branch name>

由于 merge 提交会湮灭掉一些原始 commit 导致 rebase 时带来混乱,同时 merge 提交的 commit message 本身没有什么额外有价值的信息,我个人关于 merge 提交的经验是:

如果你的角色是scm,代码集成者,多个分支隔离开发很长时间之后的合并建议使用merge;每天持续开发中的数量不多的提交都最好使用rebase,这样可以让提交记录尽量保持线性和整洁,进而方便代码的集成和追踪。

目录
相关文章
|
29天前
|
开发工具 git 开发者
|
29天前
|
开发工具 git 开发者
Git Pull vs. Git Fetch:深度解析
【2月更文挑战第29天】
93 0
Git Pull vs. Git Fetch:深度解析
|
2月前
|
开发工具 git
git merge和git rebase异同
git merge和git rebase异同
65 0
|
缓存 开发工具 git
【已解决】git pull 显示 Already up-to-date,但文件并没有更新
git pull 显示 Already up-to-date,但文件并没有更新
1247 0
|
8月前
|
开发工具 git
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
|
3月前
|
存储 网络安全 数据处理
git远程操作,推送【push】,拉取【pull】,忽略特殊文件,配置别名,标签管理
git远程操作,推送【push】,拉取【pull】,忽略特殊文件,配置别名,标签管理
|
3月前
|
开发工具 git
|
4月前
|
开发工具 git 开发者
百度搜索:蓝易云【Git:Rebase和Merge之间的区别】
综上所述,Rebase和Merge在代码合并方面具有不同的特点和用途。根据具体的情况和个人偏好,选择适合的合并方式能够更好地管理和组织代码。
40 0
|
4月前
|
前端开发 开发工具 git
git rebase 和 git merge的区别?以及你对它们的理解?
git rebase 和 git merge的区别?以及你对它们的理解?
67 1
|
4月前
|
Shell 开发工具 git
git 常用命令详解(merge/rebase/cherry-pick)
git常用命令详解。 git merge将已提交的commit(自历史记录与当前分支分开以来的提交)合并到当前分支中。 rebase变基的原理 git-cherry-pick能应用(合并)已经存在的commit,即选择合并某个特定commit

相关实验场景

更多