Skip to content

Commit 0e152e4

Browse files
committed
we have --delete now
1 parent b4ac3fa commit 0e152e4

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

book/03-git-branching/1-git-branching.asc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -775,22 +775,17 @@ There are other uses of the `pull` command that we'll address in [[_git_tools]],
775775
==== Deleting Remote Branches
776776

777777
Suppose you're done with a remote branch – say you and your collaborators are finished with a feature and have merged it into your remote's `master` branch (or whatever branch your stable codeline is in).
778-
You can delete a remote branch using the rather obtuse syntax `git push [remotename] :[branch]`.
778+
You can delete a remote branch using the `--delete` option to `git push`.
779779
If you want to delete your `serverfix` branch from the server, you run the following:
780780

781781
[source,shell]
782782
----
783-
$ git push origin :serverfix
784-
To git@github.com:schacon/simplegit.git
783+
$ git push origin --delete serverfix
784+
To https://github.com/schacon/simplegit
785785
- [deleted] serverfix
786786
----
787787

788-
Boom.
789-
No more branch on your server.
790-
You may want to dog-ear this page, because you'll need that command, and you'll likely forget the syntax.
791-
792-
A way to remember this command is by recalling the `git push [remotename] [localbranch]:[remotebranch]` syntax that we went over a bit earlier.
793-
If you leave off the `[localbranch]` portion, then you're basically saying, ``Take nothing on my side and make it be `[remotebranch]`.''
788+
Basically all this does is remove the pointer from the server. The Git server will generally keep the data there for a while until a garbage collection runs, so if it was accidentally deleted, it's often easy to recover.
794789

795790
=== Rebasing
796791

0 commit comments

Comments
 (0)