Let \(X_0\) and \(X_1\) be topological spaces, \(A\subseteq X_1\) a subspace, and \(f\colon A\to X_0\) a continuous map. The space obtained by attaching \(X_1\) to \(X_0\) along \(f\) is the quotient space \[ X_0\sqcup_f X_1\coloneqq\qty{X_0\sqcup X_1}/\qty{a\sim f(a) \text{ for } a\in A}, \] where \(\sim\) is the equivalence relation generated by \(a\sim f(a)\).
Attaching an \(n\)-cell to \(X_0\) along \(\varphi\colon S^{n-1}\to X_0\) is the case \(X_1 = D^n\), \(A = S^{n-1}\), \(f = \varphi\). For a continuous map \(g\colon X\to Y\), the mapping cylinder of \(g\) is the case \(X_0 = Y\), \(X_1 = X\times[0,1]\), \(A = X\times\ts{1}\), \(f(x, 1) = g(x)\).
See [@Hat02].