What is the role of glycine in the running buffer for SDS-polyacrylamide gel electrophoresis
The pH of stacking and resolving gel are set in such a way that one is above and one is below the pI of gly (5.97).Therefore, Gly has two different charges in stacking and resolving gel. That is in stacking gel gly has no charge (which will allow the protein to stack according to size in this part of the gel rather than separating because of presence of gly in between the protein molecules, constraint in separation of proteins) but in resolving gel charge is negative since the pH is higher (constraint in movement of proteins no longer present so separation of protein based on size possible).

Hope this was helpful..