 
 
 
 |  |      1tabris17 OP 本地分支都跟踪了远程分支 | 
|  |      2chmlai      2015-01-13 11:09:47 +08:00  1 fast-forward 就会一条线. 否则就分叉. 合并的时候使用参数 --no-ff 就总是分叉. | 
|  |      3tabris17 OP 但是我很确定没有勾选 --no-ff 选项呀   | 
|  |      5chmlai      2015-01-13 11:15:05 +08:00 @tabris17 没勾 --no-ff, 就取决于你原来的分支, 在开分支之后有没有新的 commit, 有就不能 fast-forward,  没有就默认 fast-forward(一条线) | 
|      6anytk      2015-01-13 11:21:19 +08:00  1 如果可以 Fast Forward,那么默认会 FF,不然会创建一个 Merge Commit。 设定好 Work Flow ,我比较喜欢 FF 的线性风格。推荐一篇文章: https://sandofsky.com/blog/git-workflow.html | 
|  |      7NemoAlex      2015-01-13 11:21:22 +08:00  1 如果有 merge 的话肯定就不是一条线了啊。如果没有 merge 就只是 fast forward 当然就是一条线了。 如果两个人改的根本不是一个东西,不需要 merge,那如何避免 merge 呢?做 rebase。 这个给你参考 http://stevenharman.net/git-pull-with-automatic-rebase 还有一种情况,你在 pull 的时候自动 rebase 了,而自己不知道。所以即便有 merge 也被 rebase 掉了。 | 
|  |      89hills      2015-01-13 11:25:12 +08:00  1 在分支合并到master之前,现在分支上 git rebase master一下 | 
|  |      9tabris17 OP @chmlai 但问题是那个一条线的分支也是有交叉提交的,但是合并后仍然是一条线。另外奇怪的是: pull之后那个一条线的项目提示信息和有分叉的项目提示信息不一样: 一条线的项目提示: = [up to date] dev -> origin/dev = [up to date] master -> origin/master Current branch dev is up to date. 而有分支的项目完成提示是: = [up to date] dev -> origin/dev = [up to date] master -> origin/master Already up-to-date | 
|  |      119hills      2015-01-13 11:38:22 +08:00 @tabris17 如果你就是喜欢一条线,那么: 1. 每次都rebase master后再merge,而且每次merge的时候都加 --ff-only Refuse to merge and exit with a non-zero status unless the current HEAD is already up-to-date or the merge can be resolved as a fast-forward. 这个参数来保证每次都是fast-forward,避免出现分支 2. git pull的时候用 git pull --rebase | 
|  |      12tabris17 OP 我知道原因了,在.git/config里,那个一条线的项目设置了 rebase = true |