|Storming a Redoubt at Yorktown by Eugene Lami|
Genealogists in the United States tend to forget that not all of the world's history transpired here in North America. Much of the recorded history of the world involves preparing for wars and involvement in wars. When I was studying military history at the University of Utah, we started with the Battle of Marathon in 490 B.C.E. and ended up with the U.S. involvement in Vietnam. Most of the countries of the world have repositories of some military records. As a genealogist, to begin to use military records, you need to know the history of the country you are researching. If your ancestors lived during a time of war, which almost certainly they did, it will take some very specific research to determine if any of your ancestors living at the time of the war were involved in any way.
This is a subject that could consume a lifetime. From time to time, I have been writing about military history and military records. Here is one link: "Why Military Records Matter." Subsequent to my classes in military history, I have spent a considerable amount of time reading about military history, particularly the U.S. Civil War, and I have a collection of books about military history (not all of which I have actually read). If you wanted to get started understanding military history in the United States, I suggest the following 1281 page book:
Leckie, Robert. The Wars of America. New York: Castle Books, 1998.
I am sure that there are similar books dedicated to the wars of almost every country. Here are a few of them.
Black, Jeremy. A Military History of Britain: From 1775 to the Present. Westport, Conn.: Praeger Security International, 2006. http://ebooks.abc-clio.com/?isbn=9780313080746.
Kaplan, Eran, Derek Jonathan Penslar, and David Jan Sorkin. The Origins of Israel, 1882-1948: A Documentary History, 2011. http://site.ebrary.com/id/10547405.
Kitchen, Martin. A Military History of Germany: From the Eighteenth Century to the Present Day. Secaucus, N.J.: Citadel Press, 1976.
MANTE, THOMAS. NAVAL AND MILITARY HISTORY OF THE WARS OF ENGLAND: Including the Wars of Scotland and ... Ireland. Place of publication not identified: FORGOTTEN Books, 2016.
McNabb, James Brian. A Military History of the Modern Middle East, 2017. http://www.myilibrary.com?id=994455.
Paoletti, Ciro. A Military History of Italy. Westport Conn.: Praeger Security International, 2008. http://ebooks.abc-clio.com/?isbn=9780313038877.
Pitt, Barrie. The Military History of World War II. New York: Military Press, 1986.
Worthing, Peter M. A Military History of Modern China: From the Manchu Conquest to Tian’anmen Square. Westport, Conn.: Praeger Security International, 2007.
You probably get the idea. Now, what about the military records from around the world? Fortunately, you don't have to reinvent the wheel. The FamilySearch.org Research Wiki contains a wealth of links to the repositories of military records from around the world.
Search for the country and then look to see if there is a link to "Military Records." I checked a few countries and the links are quite complete. Of course, unless you are prepared to do some extensive research and learn a lot about military organization and where the records might be located, having a link isn't going to do you much good. You will run into the same problems with common names that you do with any other type of records. Make sure the names you find agree with consistent places and other dates of events in the military person's life.
Another source for links to military records is The Family History Guide. Here is a screenshot of the United States Military Records page.
There is always a lot more to learn about genealogical research.