But, whenever possible, don't change core code. Instead:
- Implement things and plugins; https://docs.moodle.org/dev/Plugin_types
- Make a custom theme
- Use this technique: https://docs.moodle.org/dev/Overriding_a_renderer to change how thigs are displayed without changing core code.
- Make sure you understand what is possible by changing configuration options. Lots of things are that you might think require code.
If none of that works, do what Conn Warwicker said. Also, track those changes in git, or another good version control system.