This is common and is a passing phase. It is known as head banging and rocking, just as you have called it. It is regarded as self-soothing behaviour and helps the child to fall asleep.
The information provided does not constitute a diagnosis of your condition. You should consult a medical practitioner or other appropriate health care professional for a physical exmanication, diagnosis and formal
advice. Health24 and the expert accept no responsibility or liability for any damage or personal harm you may suffer resulting from making use of this content.