Debian stable has git 1.5.6.5 which is missing the --ff-only options in git pull/git merge. Is there a way to simulate this behavior with a series of alternative git commands?
Asked
Active
Viewed 413 times
2 Answers
1
Of course, I can just run merge with --no-commit and then see if anything has changed in the index. If it's a fast-forward or empty merge, then git diff --cached should be empty, given that it was empty before the merge.
zedoo
- 10,003
- 12
- 43
- 54
1
You can test if one of the commits is a descendant of the other. If one is, then that's the definition of a fast-forward merge.
If commit A is a descendant of commit B (as in, B is some Nth parent of A), then:
$ git checkout B
$ git merge A #<--- this is a fast-forward merge
But testing if commits are descendants is not the easiest. That answer lies here: How can I tell if one commit is a descendant of another commit?
Community
- 1
- 1
Alexander Bird
- 36,154
- 41
- 121
- 156