Heat butter or cooking oil then saute onion and salt on high heat until a glassy / translucent look, about 3 - 5 minutes. Onion can be diced up now or later. We can make big batches of caramelized onion, keep it in the fridge and use it as needed. For more detailed instructions check out how to make caramelized onion.
Reduce heat to low and slowly let the onions caramelize, about 15 - 25 minutes. Stir every now and again. 5 minutes before the end, mix in garlic.
Let the caramelized onion cool down. Chop it up finely if sliced. Do the same with any optional ingredients like chives, scallion or parsley.
Mix onion and optional ingredients with sour cream.