We prove that the current helicity integral for a thin magnetic tube is directly proportional to the twist Tw of field lines, which appears in the Cȃlugȃrianu formula as a summand. Using this approach, we analyze the law of the variation of magnetic helicity in a conducting medium with a nonzero magnetic diffusion coefficient and also the equation of the phase transition of the magnetic field under early universe conditions.