Update ERPNext while hava a local changes

Guys. Can you show the right way to update ERPNext while have a local changes?
I try some of the step in discussion but not successful.

Is it local changes means I have adding some doctype in the apps?

You have 4 options

  1. Commit your changes and maintain your own fork
  2. Stash your changes and re apply them (git stash)
  3. Move your changes into an app
  4. [recommended] make your changes fulfil the contribution guidelines and send a pull request.

Thank you for reply.

I already update the ERPNext and I did the git stash.
But my code in my custom doctype is gone.

Can you tell me why this happened?

Hi @iqbalzahir ,
You shouldn’t do any changes in the core doctypes. If you feel the functionality is generic enough, you can send us the pull request to merge that in the core repo. But if that is something specific to you and you want further updates of ERPNext then you should do that via hooks in your own app

In between, if you want those change back you can use
git stash pop

Thanks for reply @ManasSolanki

Okay I see.
But do you have any reference to update via hooks?
Because my new doctype is just specific for me. Its just additional doctype for me.
All ERPNext module and doctypes are great enough.