From d9574958d4129f7fb01c67fd6dc28222be9fc9c3 Mon Sep 17 00:00:00 2001 From: Soon Van Date: Mon, 31 Dec 2012 01:13:28 -0500 Subject: [PATCH 1/3] Adds instructions to delete remote branch Syntax to delete remote branch is not the same as a local one. Introduces the syntax mentioned in the book and throws in the easier to remember one to boot. Requested by, fixes #43 References: - http://git-scm.com/book/en/Git-Branching-Remote-Branches - http://stackoverflow.com/questions/2003505/delete-remote-branch --- branching/index.html | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/branching/index.html b/branching/index.html index 198bb70..1410c92 100644 --- a/branching/index.html +++ b/branching/index.html @@ -203,7 +203,7 @@ README hello.rb more.txt test.txt

If we want to delete a branch (such as the 'testing' branch in the previous example, since there is no unique work on it), - we can run git branch -d (branch) to remove it. + we can run git branch -d (branch) to remove it.

 $ git branch
@@ -215,6 +215,36 @@ Deleted branch testing (was 78b2670).
 * master
 
+

+ git push (remote-name) :(branchname) + delete a remote branch +

+ +

When you're done with a remote branch, whether it's been merged + into the remote master or you want to abandon it and sweep it under + the rug, you'll issue a git push command with special + colon to nuke that branch.

+ +
+$ git push origin :tidy-cutlery
+To git@github.com:octocat/Spoon-Knife.git
+ - [deleted]         tidy-cutlery
+
+ +

In the above example you've deleted the "tidy-cutlery" branch + of the "origin" remote. A way to remember this is to think of the + git push remote-name local-branch:remote-branch syntax. + This states that you want to push your local branch to match that + of the remote. When you remove the local-branch portion + you're now matching nothing to the remote, effectively telling the + remote branch to become nothing. +

+ +

Alternatively, you can also run + git push remote-name --delete branchname + which is basically a wrapper for the above colon prefix version. +

+

In a nutshell you use git branch to list your current branches, create new branches and delete unnecessary or From 7da3713a5679a32b299cf83ff1a418d5cd57fac3 Mon Sep 17 00:00:00 2001 From: Soon Van Date: Mon, 31 Dec 2012 15:12:33 -0500 Subject: [PATCH 2/3] Removes superfluous words in remote branch delete tips --- branching/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/branching/index.html b/branching/index.html index 1410c92..cdcdba7 100644 --- a/branching/index.html +++ b/branching/index.html @@ -222,8 +222,8 @@ Deleted branch testing (was 78b2670).

When you're done with a remote branch, whether it's been merged into the remote master or you want to abandon it and sweep it under - the rug, you'll issue a git push command with special - colon to nuke that branch.

+ the rug, you'll issue a git push command with a specially + placed colon symbol to remove that branch.

 $ git push origin :tidy-cutlery
@@ -240,9 +240,9 @@ To git@github.com:octocat/Spoon-Knife.git
     remote branch to become nothing.
     

-

Alternatively, you can also run +

Alternatively, you can run git push remote-name --delete branchname - which is basically a wrapper for the above colon prefix version. + which is a wrapper for the colon technique of deleting a remote branch.

From 7ad396af1492c62d0d03602b925147b5db4dab02 Mon Sep 17 00:00:00 2001 From: Soon Van Date: Mon, 31 Dec 2012 15:17:35 -0500 Subject: [PATCH 3/3] Includes quick aside on what a refspec is --- branching/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/branching/index.html b/branching/index.html index cdcdba7..6bea373 100644 --- a/branching/index.html +++ b/branching/index.html @@ -242,7 +242,8 @@ To git@github.com:octocat/Spoon-Knife.git

Alternatively, you can run git push remote-name --delete branchname - which is a wrapper for the colon technique of deleting a remote branch. + which is a wrapper for the colon refspec (a source:destination pair) + of deleting a remote branch.