Pushing Branches
Sharing work in progress.
You can push any branch to GitHub, not just main. That backs up your work in progress, and lets teammates see it before it's finished.

- Push any branch
- Back up work in progress
- Let others see it
Push a feature branch
We create a branch called blog, and commit a blog page. Then git push, dash u, origin, blog. GitHub now has a blog branch too. On the real GitHub, the push also prints a link to open a pull request. We'll get to those very soon.
git switch -c blog Switched to a new branch 'blog' echo '<h1>Blog</h1>' > blog.html git add blog.html git commit -m "Add blog page" [blog 55c6b9b] Add blog page 1 file changed, 1 insertion(+) create mode 100644 blog.html git push -u origin blog To https://github.com/sam/my-site.git * [new branch] blog -> blog branch 'blog' set up to track 'origin/blog'.
Seeing all branches
Git branch, dash a, shows every branch, including remote ones. Local branches first. Then, in the remotes section, origin slash blog and origin slash main. Git branch dash v v also shows which remote branch each local branch is tracking.
git branch -a * blog main remotes/origin/blog remotes/origin/main git branch -vv * blog 55c6b9b [origin/blog] Add blog page main f63a17a [origin/main] Link to about page
Summary
Push any branch with git push dash u origin, and the branch name. Git branch dash a shows remote branches too. Next, working on a teammate's branch.
Key takeaways- git push -u origin <branch>
- git branch -a
- git branch -vv