My teenage years were spent getting bashed around in beer-fuelled moshpits. My long hair would get pulled, my cardigan torn, my arms bruised … and I loved it. They were the most liberating spaces in the world; places where I could be aggressive and lose a self-consciousness that often felt oppressive. It felt great to be thrashing around, holding my ground in a mass of mostly male bodies.

In hardcore and metal scenes, a lively moshpit is still the real indicator of a successful show. But rock has been changing over the past couple of years – notably by listening to women within its factions. Punk has long claimed to be about community while, at the same time, managing to marginalise minorities. Yet the scene does now seem to be actually changing. DIY punk groups such as PWR BTTM, Diet Cig and Adult Mom have introduced safe spaces at their shows – and moshpits have often been the first casualties.

“At least at our shows, we’re trying to create a safer space, and, right now, I can’t see a way to have moshing that’s completely respectful of everyone there,” says Diet Cig’s Alex Luciano. “We get to feel safe on the stage, and we want to extend that feeling to our audience.” And there is something undeniably warm about being in these spaces. When I went to my first PWR BTTM show last year in London, everyone was dancing and laughing, and it felt like a party more than a gig. A very masculine type of aggression is being rejected here, in order that minorities – women, trans people, people of colour and so on – are able to feel free.

Such bold moves hark back to the days of “riot grrl” in the 90s where the war cry demanded “girls to the front” as a reaction against the macho punk scene. Even within metal and hardcore – where moshing is a crucial part of the live experience – these arguments are becoming less alien, and women’s stories have helped make bands and male audience members understand what it’s like to be a female rock fan.

With aggressors frequently being held accountable on social media, making women feel unsafe has started to be collectively shamed. Girls Against, a group of young women, has been successful in campaigning against – and spreading awareness of – sexual harassment at gigs.

I remember numerous occasions while I was growing up when male crowd members rubbed against me or touched me inappropriately – it was just accepted as part of the experience. I sense a sea-change, however: recently, everyone from Slaves to Swim Deep and Drenge have come out to condemn such behaviour at their shows. “Sometimes, we go and do a stint on the merchandise stand on the night, and, aside from the selfies and band chat, it can be a good place for people to talk to us about anything [that went]wrong at the show,” says Rory Loveless from Drenge, who first spoke out against sexual harassment at gigs back in 2015. “This is pretty common, as people don’t feel comfortable reporting situations to staff at the venue, or they get ignored.”

Tor-Arne Vikingstad of Norwegian punk band Sløtface believes that a sense of entitlement from certain men can extend to moshpits. “Unfortunately, things such as groping can happen to girls in moshpits, which is absolutely unacceptable. These harassment rules don’t just apply to the real world – the same rules apply in rock shows as well.” He says that now Sløtface are always looking out from the stage for any behaviour like this, and will throw out the perpetrator in a second.

Crucially, anything to do with safety at shows is always a gendered conversation. The bands bringing in these changes most enthusiastically tend to be those with female and LGBT members. The biggest defenders of moshpits are usually straight men. Most women I know who go to shows are either agnostic or hate them. Yet, the majority of rock bands want moshpits to stay. Sløtface’s vocalist, Haley Shea, says: “I have always loved the chaos and feeling of being able to blow off some steam without being judged on your dancing, how sweaty you are or any of the other superficial things you get judged on a lot, especially as a young girl.”

While She Sleeps … ‘People don’t have an outlet in real life.’ Photograph: Rex/Shutterstock

For While She Sleeps, a UK metalcore band, there is real cathartic healing in that. “Moshpits are so accepted and popular in our scene because these people don’t have that outlet in real life,” guitarist Sean Long explains. “Some fans are bottled up with emotions; without expressing them, you might end up depressed or angrier. Shows can be quite an experience for people who are suffering.”

Veteran punk musician Greg Graffin, the Bad Religion frontman, turned author and professor of evolutionary science, is cynical about bands attempting soft changes to the punk scene. To him, slam dancing – as they called moshing on the US west coast – evolved as the only real physiological reaction to punk music. “It is no different from the ‘devil music’ in the 50s that was making people move their hips,” he tells me. “It happens spontaneously like molecules starting to vibrate and bump into each other. The slam pit is a hotbed of social interaction. People are communicating on a deep emotional level.”

I tend to agree with Graffin. Emotional responses are demonised and feared in modern culture. To the outside world, a moshpit looks like the nonsensical activity of a Neanderthal – which it is. It appeals to base instincts; a positive thing, surely, in a modern culture where gigs are Snapchatted and documented, and wrapped in self-awareness that takes audiences away from experiences. However, it would be naive to think that a little release of anger by the harmless majority comes without a price. Earlier this year at a Code Orange show, a man spin-kicked a young woman in a moshpit while wearing steel toe-capped boots, leaving her with a broken jaw, internal bleeding on the brain and months in recovery. It’s easy to bemoan health and safety gone mad when you’re not on the other end of drunkenness or toxic masculinity.

While I don’t go near aggressive moshpits these days, I don’t care if others go in to them. What I do mind, though, is men smacking a beer out of my hand, or hitting into me hard when I’m standing nowhere near that front-middle danger zone. It raises the question: if moshpits are a priority, where does that excessive freedom of movement stop? What are its boundaries and limits?

Graffin and I wonder what a compromise for rock would be. We decide on pit-free zones – imposed boundaries. Tor says that on Sløtface’s rider, the band ask for extra security so that their pits can be policed to some extent.

Ultimately, any movement about empathy can’t be a bad thing. “It feels good to be part of a scene that really cares about their fans, and is vocal about wanting their shows to be safer,” says Alex. “We’re building a community here, and that’s something that’s needed right now.”