Paul Danelli
Paul Danelli

Reputation: 1114

In Fish, is it possible to ignore all Git related commands?

I know fish doesn't remember commands that start with a space, but if it possible to add a rule which ignores Git commands?

Upvotes: 1

Views: 273

Answers (3)

Zanchey
Zanchey

Reputation: 2040

Inspired by mnagle's answer, but with fish-specific features:

If you add an abbreviation for git to "git", then fish will insert a space before every git command for you!

abbr -a git ' git'

Upvotes: 5

glenn jackman
glenn jackman

Reputation: 246807

Here's a nuclear option, but it might be your best option:

function git
    command git $argv

    set history_items (history --search --prefix git)
    for item in $history_items
        history --delete $item
    end
end

Upvotes: 0

mnagel
mnagel

Reputation: 6854

what about this hack: alias git=" git"

Upvotes: 0

Related Questions