TITLE: Under what circumstances do morphisms on the stalks of a sheaf induce a sheaf morphism
QUESTION [14 upvotes]: It is very well known that if $\alpha : \mathscr{F} \to \mathscr{G}$ is a morphism of sheaves, then it induces homomorphisms on the stalks. I have been wondering for a while if given a collection of homomorphisms between the stalks of two sheaves and some suitable patching condition, can we construct a homomorphism of sheaves? 
I have been thinking about this problem a little bit lately, but I have not been able to come up with a "canonical" solution. In other words I have found ways of producing sheaf morphisms from stalk morphisms but they have always felt very unnatural. 
Let me phrase the question a little bit more formally. Let $X$ be a topological space and $\mathscr{F}, \mathscr{G}$ sheaves on $X$. Let $\alpha_p : \mathscr{F}_p \to \mathscr{G}_p$ be a homomorphism for each $p \in X$. Is there a suitable condition on the $\alpha_p$s such that there exists a sheaf morphism $\alpha : \mathscr{F} \to \mathscr{G}$ whose induced maps on the stalks are exactly the $\alpha_p$s?

REPLY [14 votes]: There is a simple condition. Stalk maps $\alpha_p : F_p \to G_p$ yield a map of sheaves $\alpha : F \to G$ if and only if for all open $U \subseteq X$ and sections $s \in F(U)$ there is an open covering $U = \cup_i U_i$ and sections $t_i \in G(U_i)$ such that $\alpha_p(s_p) = (t_i)_p$ for all $p \in U_i$ and all $i$. This can also be stated as continuity of the $\alpha_p$ (see the answer of David Roberts).
This cirterion is sometimes useful, for example in the construction of fibered products of locally ringed spaces (German: http://maddin.110mb.com/pdf/faserprodukte.pdf).