I learned about it in a book by James Clear. See his article https://jamesclear.com/identity-based-habits
ED: I must add that my comment support's parent's post, for they talked about identity based habits as well.
Taking a guess, it could be taking the identity "I want not a person that drinks alcohol" etc