Cómo eliminar tus commits de un PR enviado

Guía práctica para eliminar commits erróneos de un pull request con git rebase -i, convertirlos en drop y hacer push forzado con seguridad; opciones alternativas y precauciones.

20 ago 2025 • 2 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Cómo eliminar commits erróneos de un PR enviado

Si estás desarrollando en otra rama cambia a esa rama antes de empezar. Si trabajas directamente en main puedes omitir este paso. Usa el comando siguiente para cambiar de rama

git checkout your-branch

En GitHub abre el PR y comprueba cuántos commits incluye. Sustituye n por el número de commits en el siguiente comando y ejecútalo. Ten en cuenta que si sincronizaste un fork puede haber commits nuevos en GitHub que no aparezcan en tu editor local, así que el resultado del rebase puede ubicarse antes del primer commit del PR

git rebase -i HEAD~n

Se abrirá el editor interactivo con una lista de commits similar a esta

pick 888a17a add pnpm setting in windows (#15) pick 472jkda add pnpm setting in windows pick 472bd9c add switch button pick 0369726 add dark theme change

Localiza los commits que quieres eliminar y cambia pick por drop en las líneas correspondientes. Guarda y cierra el editor para aplicar el rebase. Si prefieres eliminar varios commits conserva solo los que necesites y elimina o marca como drop los demás.

Después de completar el rebase aplica los cambios en GitHub con un push forzado. Si quieres una opción más segura usa --force-with-lease para evitar sobrescribir cambios remotos que no conoces

git push origin HEAD:your-branch --force

Advertencia importante: el push forzado reescribe el historial de la rama remota. Antes de forzar el push crea una rama de respaldo con git branch backup-branch o informa a tus compañeros para evitar conflictos. Si no te sientes cómodo con rebase interactivo puedes usar alternativas como git reset --hard para volver a un commit concreto y luego forzar el push, pero siempre con precaución.

En Q2BSTUDIO somos una empresa de desarrollo de software que ofrece aplicaciones a medida y software a medida para cubrir necesidades específicas de negocio. Somos especialistas en inteligencia artificial e ia para empresas, creamos agentes IA personalizados y soluciones con power bi para potenciar la inteligencia de negocio. También proporcionamos servicios de ciberseguridad y servicios cloud aws y azure para desplegar y proteger tus aplicaciones. Nuestro equipo combina experiencia en servicios inteligencia de negocio, desarrollo de aplicaciones a medida y seguridad para entregar soluciones robustas y escalables.

Si necesitas ayuda para gestionar ramas y PRs en proyectos profesionales o quieres integrar procesos de devops seguros con despliegue en la nube y análisis con power bi, contacta con Q2BSTUDIO para recibir asesoría y soporte en inteligencia artificial, agentes IA, ciberseguridad, servicios cloud aws y azure y mucho más.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.