Are there any ways to reset pin setup by command line?
No, because the pin schema is not set system wide. It is set essentially per process; when you initialize a GPIO library, you may have the alternative to specify a scheme that will be used in the code (strictly then it isn't even really per process; it's just an artifact of compilation).
Different command line tools may also allow for different schemes, but this is not because the scheme is set anywhere other than in the tool itself.
Then I have code2 (not relevant to the code1) use the default pin definition (the state of pins after start or reboot). I want to run code 2, so that I have to reboot Pi to reset pin setup
You should use the GPIO library API to set the scheme you want to use in code 2.