Staff (military)
A and Q branches might be combined under a deputy assistant adjutant and quartermaster general, rank major (DAA&QMG).

G branch (operations) plans and executes operations.  The senior staff officer in brigade HQ held the appointment of brigade major (BM) with rank of captain or major, who coordinated the HQ. While the BM was responsible for the entire HQ, he concentrated mainly on "G" operational matters. A deputy BM GSO III generally looked after non-operational matters. Under the BM were several GSO III (rank captain) officers:
Operations (the senior captain)
Intelligence
Liaison. The Liaison section often had several lieutenants attached from the brigade's combat units.
Air
A branch:  It handled all personnel matters such as awards, postings, promotions, medical, chaplains, military police and so forth. There were usually one or two GSO III officers in A branch.
Q Branch:  It handled logistics, supply, transport, clothing, maintenance. There was usually one GSO III officer, with a learner captain or lieutenant, and several advisors, all captains:
Brigade Royal Army Service Corps Officer (BRASCO)
Brigade Ordnance Officer (BOO)
Brigade Electrical and Mechanical Engineer Officer (BEME)

Division level: G branch was under the colonel GS (a lieutenant-colonel).
The combined "A" and "Q" staffs was headed by a colonel AQ, who was assisted by an assistant adjutant and quartermaster general (AA&QMG, rank lieutenant-colonel).
Members of the G staff:

A GSO II, acting as deputy to the GSO I. He was responsible for the preparation of orders and instructions as directed by the GSO I; the general organization and working of the "G" office; detailing of duty officers at the Div HQ; coordinating arrangements for moving the Main HQ; details of movement by road in consultation with the DAAG and DAQMG; and general policy regarding HQ defence and the preparation and promulgation of HQ standing orders. (In an armoured division headquarters, the GSO II was responsible for the division tactical HQ and the above duties were done by the GSO III (Operations).)
The GSO III (Operations) was the understudy to the GSO II; he maintained the situation map; prepared situation reports; supervised the acknowledgement register; maintained the command matrix; prepared orders for the move of the orders group; and prepared orders for the move of the division's main HQ.
The GSO III (Operations)(Chemical Warfare) was responsible for all matters dealing with chemical warfare that affected the division; coordinated courses; was responsible for the camouflage policy; maintained the war diary; prepared and maintained location statements; received and distributed codes, call sign lists and other signals information from the divisional signals; coordinated traffic control and organization of routes in the divisional forward area under the GSO II and APM; was understudy to the GSO III (Operations) on all matters less CW.
The GSO III (Intelligence) coordinated all intelligence training and work in the division; coordinated the collection and collation of information about enemy dispositions, methods and intentions; prepared daily intelligence summaries; coordinated interpretation of air photographs with the Army Photographic Interpretation Section (APIS); effected liaison with the APIS, the field security office and the Intelligence Officer, Royal Artillery (at CRA); and was responsible for briefing and handling of press correspondents.
The GSO III (Liaison) coordinated the work of the liaison officers, was responsible for the division information room and served as an understudy to the GSO III (Operations).

Corps level: G branch was headed by the brigadier general staff (BGS, rank: brigadier). The BGS was usually superior to the AAG and AQMG, despite all three having the same rank.
A branch was headed by the Assistant adjutant general (AAG, rank: brigadier). He was assisted by the deputy assistant adjutant general (DAAG, rank lieutenant-colonel).
Q branch was headed by the assistant quartermaster general (AQMG, rank: brigadier).
The G staff for a corps might appear as below:

Operations and staff duties:
GSO I
GSO II (Ops)
GSO II (Ops)(CW)
GSO II (SD) – Staff Duties
2 × GSO III (SD)
Air:
GSO II (Air)
Intelligence:
GSO II (Int)
2 × GSO III (Int)
Liaison:
GSO II (L)
3 × GSO III (L)
Royal Artillery:
GSO II (RA)
GSO II (AA)
GSO III (RA)

Naval staff: The Admiralty War Staff was a former senior command, operational planning department within the Admiralty during World War I. It was instituted on 8 January 1912 and was in effect a war council whose head reported directly to the First Sea Lord. It existed until 1917. After the war ended, it was replaced by the Admiralty Naval Staff department.
The Admiralty Naval Staff was the senior command, operational planning, policy and strategy department within the British Admiralty. It was established in 1917 and existed until 1964 when the department of the Admiralty was abolished and was replaced by the Naval Staff, Navy Department (Ministry of Defence).

See also: Staff college

References: 

Further reading: Bartholomees, J. Boone Buff Facings and Gilt Buttons: Staff and Headquarters Operations in the Army of Northern Virginia, 1861–1865 (University of South Carolina Press, 1998) ISBN 1-57003-220-3.
Crosswell, D.K.R. The Chief of Staff: The Military Career of General Walter Bedell Smith (Greenwood Press, 1991) ISBN 0-313-27480-0.
Fremont-Barnes, G. (editor) Armies of the Napoleonic Wars (2011)
Goerlitz, Walter History of the German General Staff 1657–1945 (Praeger 1954).
Hittle, James Donald The Military Staff: Its History and Development (Military Service Publishing, 1944)
Jones, R. Steven J The Right Hand of Command: Use and Disuse of Personal Staffs in the American Civil War (Stackpole Books, 2000) ISBN 0-8117-1451-9.
Koch, Oscar W. G-2: Intelligence for Patton: Intelligence for Patton (Schiffer Aviation History, 1999) ISBN 0-7643-0800-9.
Purdy, Leo and Purdy, Tony. 'Primus inter pares vel primos? The Development of the Military Staff in the Australian Army', Australian Army Journal, Vol. 19, No.1, (2023), https://researchcentre.army.gov.au/library/australian-army-journal-aaj/volume-19-number-1
Pigman, Robyn. "All Systems Green: A Concise History of Chicken Bak Bak and the S-6 Offensive" (Nelson Ltd) ISBN 978-9948150510.
Regele, O.: Generalstabschefs aus vier Jahrhunderten  (Vienna 1966)
Watson, S.J. By Command of the Emperor: A Life of Marshal Berthier (Ken Trotman Ltd) ISBN 0-946879-46-X.
Irvine, D.D. The French and Prussian Staff Systems Before 1870 in The Journal of the American Military Foundation Vol. 2, No. 4 (Winter, 1938), pp. 192–203 (https://www.jstor.org/stable/3038792?seq=1#fndtn-page_scan_tab_contents)

External links: 
Changes needed in the "General Staff" system, research paper.
History of "General Staff" system