If I (have) ~ and I wish (I have) ~

D. If I ~ and I wish ~

a. If you feel a real possibility: ‘If I ~’, ‘I'll ~ ‘can be used. When you imagine a situation, you use ‘if + past’ (if I knew/ if you were/ if we didn't etc.). But meaning is present, not past. (e.g. Tom would read more if he had more time. (but he doesn't have much time))
b. use the past in the same way after ‘wish’ (I wish I knew/ I wish you were etc.). We use ‘wish’ to say that we regret something, that something is not as we would like it to be. (e.g. I wish I knew Paul's phone number. (= I don't know it and I regret this))
c. After ‘if’ and ‘wish’, you can use were instead of was (if I were ~/ I wish it were etc.). I was/ it was are also possible (e.g. If I were you, I wouldn't buy that cost./ If I was, ~ .)
d. We do not normally use ‘would’ in the ‘if-part’ of the sentence or after ‘wish’. (e.g. If I were rich, I would have a yacht. (not if I would be rich))
e. 'could' sometimes means 'would be able to' and sometimes 'was/ were able to'. (e.g. You could get a better job if you could use a computer. (you could get = you would be able to get) (you could use = you were able to use))

D2. If I had ~ and I wish I had ~

a. use ‘if + had ('d) ~ to’ talk about the past (if had known/ been/ done etc.) (e.g. I didn't see you when you passed me in the street. If I'd seen you, of course I would have said hello. (but I didn't see you))
b. I'm not hungry. If I was hungry, I would eat something. (now) vs. I wasn't hungry. If I had been hungry, I would have eaten something. (past)
c. Do not use ‘would’ in the ‘if-part’ of the sentence. We use ‘would’ in the other part of the sentence. (e.g. If I had seen you, I would have said hello. (not If I would have seen you))
d. 'd’ can be would or had. (e.g. If I'd seen you. (I'd seen = I had seen), I'd have said hello. (I'd have said = I would have said))
e. use ‘had (done)’ in the same way after ‘wish’. I wish something had happened = I am sorry that it didn't happen. (e.g. I wish I'd known that Gary was ill. I would have gone to see him. (but I didn't know))
f. Do not use 'would have ~' after ‘wish’. (e.g. The weather was cold while we were away. I wish it had been warmer. (not I wish it would have been))
g. If I had gone to the party last night. I would be tired now. (I am not tired now - present) vs. If I had gone to the party last night. I would have met lots of friends. (I didn't meet lots of friends - past) (e.g. If the weather hadn't been as bad, we would have gone out./ we could have gone out. (= we would have been able to go out) or we might have gone out. (= perhaps we would have gone out))

more about If and Wish