Version Control
Git: Getting started
Git: Getting started
  • Introduction
    • What is version control
      • Distributed VCS
      • Summary
    • What is Git?
      • A Short History of Git
      • Under the hood
      • The Three States
    • What is GitHub?
  • Setting up Git
    • Installation
    • First time setup
    • Creating a repo
  • Basic operations
    • Recording Changes
      • Add another file
      • Modify-stage-commit
      • Modify-direct commit
      • View log
    • Undo changes
      • Restore (modified)
      • Restore (staged)
      • Amend (rare)
    • Clone repos
  • Remote Repos
    • Configure remote
    • Push to remote
      • Push branches
  • Reference
    • My Git Tutorials
    • Git Official
    • Others
Powered by GitBook
On this page
  1. Remote Repos
  2. Push to remote

Push branches

Push other branches

If you want to push changes made in other local branches to the remote repository, you need to switch to the branch and then use the git push command with the branch name. For example, if you have a local branch named new-feature, you can push changes in that branch to the remote repository using the following command:

git push -u origin new-feature

This will push the changes made in the new-feature branch to the remote new-feature branch in the origin repository.

In summary, the git push command only pushes changes in the current branch to the remote repository by default. If you want to push changes in other local branches, you need to switch to the branch and use the git push command with the branch name.

PreviousPush to remoteNextMy Git Tutorials

Last updated 2 years ago