Pullback on $\textbf{Set}$ Let $f:X \rightarrow B \leftarrow Y:g$ be a diagram in Set. If $Y$ is a $B$-indexed set $\{G_{b}\}$, the pullback for such diagram is the $X$-indexed set $P := \{G_{fx}\}_{x \in X}$.
My question is: What are the morphisms $g': P \rightarrow X, f':P \rightarrow Y$ that make
$$\require{AMScd}
\begin{CD}
P @>f’>>Y\\
@Vg’VV @VVgV\\
X@>>f>B
\end{CD}$$a commutative square?
Edit: Example taken from Mac Lane's book, Sheaves in geometry and logic, section 2 of chapter 1 (Pullbacks), pages 29 and 30.
 A: As noted in the comments, the pullback of this diagram is $$P = \{(x,y)\mid x\in X, y\in Y, f(x) = g(y)\} \subseteq X\times Y,$$ and the projections are $g' = \pi_X|_P$  and $f' = \pi_Y|P$.
But the point of the example is to reframe the pullback in terms of indexed sets. Here Mac Lane and Moerdijk are using the fact that there is a natural correspondence between arbitrary arrows into $B$ and $B$-indexed sets. Given an arrow $h\colon A\to B$, we form the $B$-indexed set $\{H_b\}_{b\in B}$ where $H_b = h^{-1}(\{b\}) = \{a\in A\mid h(a) = b\}$. And given a $B$-indexed set $\{H_b\}_{b\in B}$, we define $A = \bigsqcup_{b\in B} H_b$ and $h\colon A\to B$ by $h(a) = b$ if $a\in H_b$.
Ok, so we view the arrow $g\colon Y\to B$ as describing a $B$-indexed set $\{G_b\}_{b\in B}$, and we view the arrow $g'\colon P\to X$ as describing an $X$-indexed set $\{G'_x\}_{x\in X}$. What is the latter $X$-indexed set? Well,
\begin{align*}
G'_x &= \{(x',y')\in P\mid g'(x',y') = x\}\\
&= \{(x,y)\mid y\in Y,g(y) = f(x)\}\\
&\cong \{y\in Y\mid g(y) = f(x)\}\\
&= G_{f(x)}.
\end{align*}
So we can describe the pullback of the $B$-indexed set $\{G_b\}_{b\in B}$ along $f$ as $\{G_{f(x)}\}_{x\in X}$.
A: To answer your question about what $g'$ and $f'$ are, you first need to see, in Alex Kruckman's answer, that $G'_x$ is not literally $G_{f(x)}$ but rather a bijective copy of it.  Then $g':P\to Y$ sends each of the subsets $G'_x$ of $P$ to the corresponding subset $G_{f(x)}$ of $Y$ by that bijection. And $f'$ maps each $G_x'$ to the single point $x$.
A: It doesn’t make sense to write $Y=\{G_b\}$ rather than $Y=\cup_{b\in B} Y_b$. There is nothing called $G$ here. Now then, $P$ is, by definition, $\sqcup_{x\in X} Y_{fx}$. Then $g’$ sends the copy of $Y_{fx}$ indexed by $x$ to $x$, and $f’$ sends it to $Y_{fx}\subset Y$ by the identity.
