amalloy
amalloy

Reputation: 91897

Can I make git merge --ff act like --ff-only?

I sometimes want to do a --ff-only merge, and it's a little awkward to tab-complete, because --ff exists. But --ff is the default behavior, and I can't imagine ever wanting to specify it explicitly. Can I make --ff a synonym for --ff-only? I know I can make an alias like ff-merge, but I'm not thrilled about that solution. I'd also be happy with a solution that causes --ff<TAB> to complete to --ff-only.

Upvotes: 6

Views: 96

Answers (1)

Paul Hicks
Paul Hicks

Reputation: 13999

Answering the bit

I'd also be happy with a solution that causes --ff to complete to --ff-only.

In bash, find which script is used to configure your git completions. On my system it's /etc/bash.completion.d/git-completion.bash.

In there, find the bit specifying the options for git merge. In my script, there's a variable __git_merge_options. Your best bet is to search for --ff-only.

In that variable, remove --ff, so that only --ff-only and --no-ff (and other unrelated options) remain.

Save and source that script.

Voilà.

Upvotes: 7

Related Questions