an electronic control device for a vehicle and a method of controlling the vehicle are provided . the electronic control device includes a communication unit that is connected to an electronic control device of a second vehicle and transmits data thereto . a memory stores a first program that controls a first vehicle and a controller executes predetermined processes . the predetermined processes include receiving version data of a second program that controls the second vehicle via the communication unit and comparing a version of the second program with a version of the first program . the first program is transmitted to the electronic control device of the second vehicle via the communication unit to operate the second vehicle using the first program when the version of the first program is newer than that of the second program .