Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Collier
17,774 PointsBranch still showing locally after deleting from github?
At the end of the video we merge the add-readme branch to master and are given the option to delete the add-readme branch, which I did. My repo on github is showing just 1 branch, master. However, the add-readme branch is still showing on my local machine.
When I run git branch I get:
$ git branch add-readme
- master
I can also checkout the branch by running git checkout add-readme:
$ git checkout add-readme Switched to branch 'add-readme'
When I pull it tells me that I'm already up-to-date. Is this normal? Is there another step that you normally run after deleting a branch on github to make sure that the change flows though everywhere else?
Thanks
2 Answers
Martin Murphy
19,321 PointsIf you want to delete the branch locally then you can run 'git branch -d add-readme'
Chris Collier
17,774 PointsThank you both
Luke Pettway
16,593 PointsLuke Pettway
16,593 PointsThis is a good answer. To elaborate further, Git is a distributed system. What that means is that your local copy of a git repository is isolated from any other remote git repositories. When you are doing a push/pull to another repository, you are essentially syncing your local git with the remote version. In order to sync your local branches with your remote branches you need to run
git fetch -p
. This command "prunes" non-existing remote branches from your local repo.