Veezus Kreist

Prune your remotes

Lark and I were working on a project the other day and were nowhere near a commit at the end of the day. So we created a feature branch and pushed a WIP commit:

1
2
3
4
5
6
veez ~/code/some_app (master)$ git co -b client_edits_business
M        app/models/user.rb
M        spec/models/user_spec.rb
...
Switched to a new branch 'client_edits_business'
veez ~/code/some_app (client_edits_business)$ 

We finished up the feature the next day, and a week or so later Lark IMed me asking if there was anything on the branch that needed saving. I knew there wasn’t, so I deleted the remote branch:

1
2
3
4
5
6
7
8
9
10
11
veez ~/code/some_app (master)$ git branch -a
  client_edits_business
* master
  remotes/origin/client_edits_business
  remotes/origin/master
veez ~/code/some_app (master)$ git branch -d client_edits_business
Deleted branch client_edits_business (was 1fc95e5).
veez ~/code/some_app (master)$ git push origin :client_edits_business
To git@github.com:hashrocket/some_app.git
 - [deleted]         client_edits_business
veez ~/code/some_app (master)$ 

The next morning Lark asked me about the branch again, as it was still showing up in his tracked branches:

1
2
3
4
jon@mbp2:~/git_hashrocket/some_app$ git branch -a
* master
  remotes/origin/client_edits_business
  remotes/origin/master

The solution? Prune your remote:

1
2
3
4
jon@mbp2:~/git_hashrocket/some_app$ git remote prune origin
Pruning origin
URL: git@github.com:hashrocket/some_app.git
* [pruned] origin/client_edits_business

Post a comment


(lesstile enabled - surround code blocks with ---)