Suppose $X_1$ is a manifold which has a tubular end $\mathbb R^+\times Y$, and $X_2$ is a manifold which has a tubular end $\mathbb R^-\times Y$. Here, $X_1,X_2$ are orientable manifolds and $Y$ is a compact manifold of one dimension lower.
Suppose we have vector bundles $E_i,F_i$ on $X_i$ ($i=1,2$), all of the same rank and equipped with metrics, and we are provided with unitary trivializations of these over the ends (all of which identify the fibers with the fixed vector space $V$). Suppose that $D_i$ ($i=1,2$) is a first order linear elliptic differential operator $E_i\to F_i$, and suppose that in the trivialization over the ends, it is of the form $\frac{d}{dt}+L$, where $t$ is the coordinate on $\mathbb R^{\pm}$, and $L$ is a self-adjoint invertible elliptic operator on $Y$ (acting on $V$ valued functions).
Then for any $T>0$, we can take $X_1\setminus(T,\infty)\times Y$, $X_2\setminus(-\infty,-T)\times Y$ and define $X^\sharp_T$ to be the obvious glued manifold, and we denote by $E^\sharp_T,F^\sharp_T$ the corresponding vector bundles on $X^\sharp_T$, equipped with the glued operator $D^\sharp_T$. Then, it is well-known that the index adds up: $\text{ind} (D^\sharp_T) = \text{ind}(D_1)+\text{ind}(D_2)$.
I think I've found a very simple proof of this fact and it would be nice if someone could verify it or point out obvious mistakes. Here it is:
For every $T>0$, choose functions $\varphi_1,\varphi_2:\mathbb R\to[0,1]$ such that $\varphi_1^2+\varphi_2^2=1$, $\varphi_1=0$ on $(3T/4,\infty)$, and $\varphi_2=0$ on $(-\infty,T/4)$. We can easily arrange that $||\nabla\varphi_1||_{L^\infty}$ and $||\nabla\varphi_2||_{L^\infty}$ are of the order of $1/T$. We may view $\varphi_1,\varphi_2$ as functions on $X_1,X_2$ or even $X^\sharp_T$ in an obvious manner (extended by $0$ or $1$ as appropriate).
Now, for we define the "tube" $C_T$ by gluing $\mathbb R^+\times Y$ with $\mathbb R^-\times Y$ along the intervals $(0,T)\times Y$ and $(-T,0)\times Y$ using the identification $(t,y)\mapsto(t-T,y)$. Fix a metric on $Y$, and take the product metric on $\mathbb R^\pm\times Y$ and extend this to metrics on $X_1$ and $X_2$. Now, we make the following observation.
The map $L^2(X_1,F_1)\oplus L^2(X_2,F_2)\to L^2(X^\sharp_T,F^\sharp_T)\oplus L^2(C_T,V)$ given by $(\xi_1,\xi_2)\mapsto(\varphi_1\xi_1+\varphi_2\xi_2,-\varphi_2\xi_1+\varphi_1\xi_2)$ is an isometry. A similar statement holds for $W^{1,2}$ spaces associated to the $E_i$'s. Now, we may consider the map $D^\sharp_T\oplus(\frac{d}{dt}+L)$ and via this isomorphism, it gives a map $W^{1,2}(X_1,E_1)\oplus W^{1,2}(X_2,E_2)\to L^2(X_1,E_1)\oplus L^2(X_2,E_2)$. An easy computation shows that this is a compact $T$-dependent zeroth order perturbation of $D_1\oplus D_2$ and further, the operator norm of the perturbation term goes to zero at $T\to\infty$, since it is controlled by $||\nabla\varphi_1||_{L^\infty}+||\nabla\varphi_2||_{L^\infty}$. It's also well-known that $D^\sharp_T$ is Fredholm and that $\frac{d}{dt}+L$ is an isomorphism, and thus, we get the result from the invariance of Fredholm index under compact perturbation. Also note that if $D_1,D_2$ were surjective to begin with, then so is $D^\sharp_T$ for large $T$ and the kernels of $D_1$ and $D_2$ "glue" to give the kernel of $D^\sharp_T$.
(The proof idea is taken from "Sc-smoothness, retractions and new models for smooth spaces" by Hofer, Wysocki, Zehnder where a similar construction is called the "total gluing map" and the original statement of the result is from "Floer homology groups in Yang-Mills theory" by Donaldson.)