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 trialDaniel Goldberg
12,443 PointsIs there a way to push all your branches to github at once?
I would imagine pushing each branch to your github repository one by one could get extremely tedious on a large project and seems unnecessary. Is there a way to push the entire project, including all branches, in one command?
3 Answers
Vance Rivera
18,322 PointsYes I think the best practice is if you have a branch or multiple branches that are ready to go first thing is to switch to your master and get the latest on the project then commit/merge each branch to your local repo. The reason you do this is if anything has changed that you were working on or commit to you will be forced to fix any conflicts on your local repo first before pushing your changes to the remote repo(this is needed if you are working with others on the same project, if you are working solo you can skip getting latest on the project). So at this point when you have successfully gotten latest and merged you branches to your local repo you are now ready with all the changes to push. Hope this makes sense and helps. Cheers!
Jason Anders
Treehouse Moderator 145,860 PointsI would think that you should be pushing each branch to the repository before you checkout a new branch anyway. So in the end, all branches are already pushed to the repository. In Development, you can't work in multiple branches (at least not that I know of), so before switching to a new branch, the current one would be committed and pushed. Right?
Marc Sanchez
20,039 PointsMerge them and then push.
Vance Rivera
18,322 PointsThis is correct.