I will phrase this question in terms of attaching smooth manifolds along a submanifold, though it is certainly more general.


Let $M\_1$ and $M\_2$ be smooth $n$-manifolds (maybe closed, for simplicity), $N$ a closed $k$-manifold, $D$ a closed $(n-k)$-disk bundle over $N$ (so that $D$ is an $n$-dimensional manifold whose boundary is the associated $(n-k-1)$-sphere bundle), and suppose we have embeddings $f\_i:D\rightarrow M\_i$.


Now say $\tilde{M\_i}=M\_i\setminus f(N)$, let $E\_0$ be the punctured-open-disk bundle associated with $D$, and let $\alpha:E\_0\rightarrow E\_0$ be defined by sending $v\_x$ in the fiber of $x\in N$ to the point $(1-|v\_x|)\frac{v\_x}{|v\_x|}$ in the same fiber (intuitively, $\alpha$ turns $E\_0$ inside-out so that we can attach the manifolds with a "collar"). 


Then if we form the Topological pushout of $\tilde{M\_1}$ and $\tilde{M\_2}$ using the smooth embeddings $f\_1|\_{E\_0}$ and $f\_2|\_{E\_0}\circ \alpha$, this in fact produces a pushout in the smooth category. The resulting manifold $M$ then has a tangent bundle, and in fact this tangent bundle can be formed by attaching the tangent bundles of $M\_1$ and $M\_2$ using the same recipe.


So, finally, here is the question: is there a formula for characteristic classes of $M$ (maybe just restrict attention to Stiefel-Whitney, Chern, Pontryagin classes) in terms of the characteristic classes of $M\_1$, $M\_2$, and $N$ (and the embeddings $f\_1$, $f\_2$)? More generally, is there a similar formula for attaching arbitrary bundles over arbitrary topological spaces (i.e. we would form a topological pushout on the base spaces and indicate how the fibers would be identified over points that are glued together)?



Characteristic classes of a fibered sum
It depends what you mean by "formula", since you are talking about cohomology classes in different manifolds, so at the very least you need a way to relate them, which depends on context. So the "answer" is the Mayer-Vietoris sequence. Naturality of characteristic classes, together with the fact that the characteristic classes of (the tangent bundle of) a disk bundle $D(E)\to M$ can be computed using $TD=TM\oplus E$ gives you some information which you then have to put together.


For characteristic numbers, there are formulas, eg Novikov additivity gives a formula for the signature of $M$ in terms of those of $M\_1, M\_2$ and $D$. Similarly for the Euler characteristic. If you glue $D\times I$ to $(M\_1\cup M\_2)\times I$ you get a bordism from $M\_1\cup M\_2$ to $M$ and so bordism invariance of characteristic numbers can be helpful.


