You can use postaction along with dash pattern for this.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[->,postaction={-,draw=green,dash pattern=on 0pt off 5cm on 2cm off 2cm}] (0,0) -- (25:8cm) ;
\end{tikzpicture}
\end{document}

EDIT: A somewhat cleaner version (because no line gets overdrawn, which makes a difference if the opacity is nontrivial) which is cast into a style.
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[replace stretch/.style args={from #1 to #2 by #3}{%
/utils/exec=\pgfmathsetmacro{\offlen}{#2-#1},
dash pattern=on #1 off \offlen pt on 10cm,
postaction={#3,dash pattern=on 0pt off #1 on \offlen pt off 10cm}}]
\draw[->,replace stretch={from 5cm to 7cm by {-,draw=green}}] (0,0) -- ++(25:8cm);
\draw[->,replace stretch={from 5cm to 7cm by {-,draw=white}}] (0,1) -- ++(25:8cm) ;
\draw[->,replace stretch={from 5cm to 7cm by {-,draw=none}}] (0,2) -- ++(25:8cm) ;
\end{tikzpicture}
\end{document}
