Hi,
Thank you for the ask. Which mode were you in when you were trying to publish? If you are in the LIVE mode and your DF has GIT enabled, you will not be able to publish your changes. Please check the links below. Hope this helps. Thank you!
https://www.madeiradata.com/post/azure-data-factory-clear-out-the-garbage
https://github.com/Azure/Azure-DataFactory/tree/main/SamplesV2/ContinuousIntegrationAndDelivery