Skip to main content
Senior

Deleting a Remote Branch

Senior

Task

Delete the foo branch from the remote repository origin.

Requirements

  • Delete specifically the remote foo branch.
  • Do not change the local main or the remote main.
  • Use the delete refspec with push.

Expected result

The foo branch must disappear on origin, and the local pointer o/foo must be removed. The other branches must be preserved.

What you will learn

After completing this task you will be able to:

  • delete remote branches;
  • understand the special refspec with an empty source;
  • distinguish deleting a branch on origin from deleting a local branch.
Goal
localC0C1HEAD main o/mainC2
originC0C1HEAD mainC2
Git trainer0 commands
terminal
localC0C1HEAD main o/mainC2o/foo
originC0C1HEAD mainC2foo