Suppose we have two (smooth) functions $f,g:X\to Y$, where $X,Y$ are smooth (second-countable, Hausdorff) manifolds which are locally homotopic (that is, any point in $X$ has a neighbourhood $U$ such that for any $V$ contained in $U$ with its closure, there is a homotopy which turns $f$ into $g$ in $V$, but keeps them fixed outside $U$).
Are $f,g$ necessarily homotopic? If the answer is yes, how much can we weaken the assumptions?
This seems rather obvious if $X$ is compact, for example, but I can't think of an easy way to show it in general, although it seems to be intuitively true.