Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to Checkout Remote Branch in Git?
Next article icon

How To Delete Remote Branch in Git?

Last Updated : 03 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Git is an important tool in the process of application development and is used widely in the software industry by developers to maintain the codebase. Using this developers are able to organize their codebase and manage the version history of their project.

Now, as a developer, you need to know how to delete a Git branch because it will lead to a better productivity approach, and for that, we have discussed ways to delete Git branches. In this article, I’ll guide you through the entire process of deleting a git remote branch.

Steps to Delete Remote Branch in Git:

Step 1: To see all the branches, write this command in your terminal

git branch
gtb
Screenshot-(291)


Step 2: To completely remove a remote branch, you need to use the git push origin command with a -d flag, then specify the name of the remote branch.The command is as follow:

git push origin -d branch-name

For example: to remove the new_branch branch, I will run git push origin –d new_branch:

git push origin –d new_branch
Screenshot-(292)
How To Delete Remote Branch in Git?

You can see the remote branch, new_branch, is not listed anymore. If you check GitHub again, it won’t be there:

Screenshot-(293)

Next Article
How to Checkout Remote Branch in Git?

B

bishal1289be21
Improve
Article Tags :
  • Web Technologies
  • Git

Similar Reads

  • How to Delete Local Branch in Git?
    Git is a widely used distributed version control and source code management system. It effectively tracks changes to source code, enabling effortless branching, merging, and versioning. What are Local Branches? In Git, branches are lightweight pointers to commits in the repository's history. Each br
    1 min read
  • How to Delete a Remote Tag in Git?
    Git tags are important for marking specific points in your repository's history, often used for releases. However, there may come a time when you need to delete a remote tag. Here’s a simple guide to help you understand how to do this. Table of Content What is a Git Tag?Why Delete a Remote Tag?Steps
    2 min read
  • How To Fetch Remote Branches in Git ?
    Git provides a powerful version control system that allows developers to collaborate efficiently on projects. Over time, however, a repository can have local and remote branches. Local branches are created locally and only exist on local machines and the remote branches exist on the remote repositor
    3 min read
  • How to Delete a Branch in Git?
    When working with Git, it’s common to create branches to isolate changes and work on new features or fixes. However, once a branch has served its purpose, it’s often necessary to delete it to keep your repository clean and organized. In this article, we’ll see the process of deleting a Git branch us
    3 min read
  • How to Checkout Remote Branch in Git?
    When working on collaborative Git projects, managing different versions of your code through branches is crucial. Often, developers need to switch between branches, especially remote ones, to work on specific features or bug fixes. In this comprehensive Git tutorial, we’ll teach you how to easily ch
    5 min read
  • How to Delete Branch in Gitlab?
    When working with Git, it's common to create branches to isolate changes and work on new features or fixes. However, once a branch has served its purpose, it's often necessary to delete it to keep your repository clean and organized. In this article, we'll see the process of deleting a Git branch us
    2 min read
  • How to Delete Branch in Github?
    In Git repositories, branches are important for organizing and managing code changes, but over time, unused or outdated branches can clutter the repository. Deleting these branches helps maintain a clean and manageable codebase. In this article, we'll explore the process of deleting branches in GitH
    2 min read
  • How to Create a Remote Git Branch?
    Creating a remote Git branch allows multiple developers to work on different features or fixes simultaneously. It ensures a clean and organized workflow, enabling collaboration without affecting the main codebase. This article covers the steps to create a remote Git branch and push it to a remote re
    2 min read
  • How to List Remote Branches in Git?
    Git is a powerful version control system that allows developers to collaborate on projects, maintain code history, and manage multiple lines of development through branching. One common task when working with Git is to list all branches in a remote repository. This article will guide you through the
    3 min read
  • How to Clone all Remote Branches in Git?
    Cloning a repository is a common task when working with Git, but what if you need all the branches from a remote repository? By default, Git clones only the default branch (usually 'master' or 'main'). However, you may need access to all remote branches in many scenarios. This article will guide you
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences