Well, some like Sheldon Cooper have Eidetic memory and can remember everything. But for most, it's simply impossible. The necessity is unclear, especially considering the fast IT development pace, creating obsolescence and innovations.
Among the great way to circumvent our limitations and the situations are general skills and experience.
Specialization is in demand, but long term success requires:
Learning by doing is a proven method to accumulate knowledge and know-how for the longterm. In the programming world it also means:
When it comes to "remembering," Good organization and knowledgement management practices will sort the details. They are technical means. It becomes a question of organization and structure.
Organization and discipline to commit to the routine of safeguarding and formalizing the accumulated knowledge and information.
A standard solution is a file system on a cloud drive or SharePoint for a re-usable script. But the organization is very personal and might be tedious at the time of retrieving the needed information.
For ideas, notes, and concepts, tools like OneNote, Evernote might be a solution.
An alternative is a solution like CodeNPaste:. It relied on a tag system and specialized index search to help you organize and retrieve the programming knowledge and details you have accumulated. In addition, it offers a dedicated environment for both code and notes using a code editor. As a result, CodeNPaste: saves retrieval times and mental energy.