The IDF traces its roots to Jewish paramilitary organization in the New Tishuv starting with the Second Aliya.
The first such organization was Bar-Giora, founde in September 1907. It was converte to Hashomer in April 1909, which operated until the British Mandate of Palestine came into being in 1920.
Hashomer was an elitiest organization with narrow scope and was mainly created to protect against criminal gangs seeking to steal property. During the WW1 the forerunners of the Haganah/IDF were te Zion Mule Corps and the Jewish Legion.
After the Arab riot in April 1920, the Yishuv leadership saw the need to create a nationwide underground defence organization and the Haganah was founded in June of the same year. The Haganah became a full scale defense force after the 1936-1939 Arab revolt in Palestine with an organization stracture, consisting in three main units: The Field Corps, The Guard Corps and the Palmach.
During WW2, the successor to the Jewish Legion of WW1 was the Jewish Brigade.The IDF founded following the establishment of the State of Israel, after Defense Minister and Prime Minister David Ben Gurion published the order of its creation on May, 26, 1948. The order called for the establishment of the Israel Defense Force (IDF), and the abolishment of all other Jewish armed forces.
Although, Ben-Gurion had no legal authority to issue such an orer, the order made legal by the cabinet on may,31. The two other Jewish underground organization, Irgun and Lehi, agreed to join the IDF if they would be able to form independent units and agreed not to make independent arms purchases. This was the background if the dispute wich led to the Altalena Affair, when following a confrontation regarding the weapon it brought resulted in a battle between Irgun members the newly created IDF. It ended when the ship was shelled. Following the affair, all independent Irgun and Lehi units, were either disbanded or merged into the IDF.
The Palmach, a strong lobby within the Haganah, also joined the IDF with provision, and Ben-Gurion responded by disbanding its staff in 1949, after which many senior Palmach officers retired, notably its first commander Itzhak Sadeh. The new army organized itself during the 1948 Arab-Israeli war, when Syria, Lebanon, Jordan, Egypt, Iraq, Saudi Arabia and Yemen, declared war on Israel.
Twelve infanty and armored brigades were created: Golani, Carmli, Alexandroni, Givati, Etzioni, the 7th and 8th amored brigades, Oded, Harel, Yiftach and Negev.
After the war, some of the brigades were converted to reserve units, and other were disbanded. Golani and Givati are still on service.
Immediately after the 1948 war, Israel Defense Forces shifted to low intensity conflict against Arab Palestinian guerrillas.
The 1956 Suez Crisis was the IDF first test of strength after 1949, an the new army proved itself by capturing Sinai Penninsula from Egypt, which is immediately returned.
In the 1967 Six days War, Israel captured the Sinai Pennisula (2nd time), West Bank and Golan Heights from the surrounding Arab states, changing the balance of power in the region, a well as the role of the IDF.
In the following years leading up the Yom Kippur war, the IDF fought war of attrition against Egypt in the Sinai and a border war against the PLO in Jordan, culminating in the battle of "Karameh".
The surprise od the Yom Kippur war and its aftermath completley changed the IDF procedures and approach the warfare/ Organizational changes were made and more time was dedicated to training for conventional warfare. However, in the following years, the army's role slowly shifted again to low intensity conflict, urban warfare an counter-terrorism.
It was involved in the Lebanese Civil War, intiating operation Litani and later Lenanon war, where the IDF ousted Palestinian guerilla organizations from Lebanon. Palestinian militancy and Hezbollah has been the main focus of the IDF ever since, especially during the first and second Intifadas, operation Defensive Shield, Gaza War and Lebanon war 1 & 2, causing the IDF to change many of its values and published the IDF spirit.