If you can master these four bar chord shapes, you will be able to play the six primary chords in ANY KEY you need to. This is a very powerful trick that can come in very handy.
The first shape is based on a root 6 E major chord, which we can show like this: 022100. The numbers indicate the frets, and the first number is the lowest, 6th string.
The second shape is based on the root 6 E minor chord, which we can show like this: 022000.
We call these two chords "root 6" chords, because the root note for the chord shape is on the 6th string. This is really important because that root note is the key to moving this shape elsewhere on the fretboard, to create different chords.
If we keep the entire pattern intact, we can move the root note up to the 5th fret, which is an A note, and then we can get either an A major chord (577655) or an A minor chord (577555). Do you see how the shapes remain the same, except that now we've added the barring finger?
The other two shapes you'll need are root 5 chords, meaning the root note is on the 5th string. They're based off the open A major shape (x02220) and open A minor shape (x02210). The x indicates you don't play that note, which in this case is the 6th string.
Again, if you move those shapes to a different location on the fretboard, you'll produce a chord with the new root note you choose, and depending on which of those two shapes you choose, you'll get either a major or a minor sound.
So, if we went to the 7th fret, we'd have an E major (x79997) or an E minor (x79987).