How to print a function definition in Bash?

I have defined a few different functions in my .bash_profile. I usually remember the name of function but want to take a quick peek in the code before I run it.

In my .bash_profile I have the following:

gpm () {
  echo "git pull origin master"
  git pull origin master
}

Now I want to run something like this in Bash:

$ <something> gpm

Result expected: Don't execute the function just print out the function definition itself.


EDIT: The best answer isn't this one, but the other one below.

What this answer used to say is that you can get a function definition in bash using the type builtin, e.g. type gpm. However, using declare as described in the other answer is better in every way.


declare -f gpm will just print the function definition of function gpm with no other text.