'Was' is used with the first person singular, i. e. 'I' and third person singular i. e. 'he, she, it'.
'Were' is used with second person singular and plural i. e. 'you/ you all' and first and third person plural i. e. 'we', 'they'.
The pronoun 'I' can be used with 'were' as a conditional as well as with 'was'. 'Were' is the past subjunctive of the present verb 'to be', meaning it expresses hope, possibility or supposition rather than stating a fact.
To remember the use of was and were it is important to understand when is each of them used and in what condition.
Doubts on this article