Wednesday, April 1, 2020

Push a new local branch to a remote Git repository

Q- How to push a new local branch to a remote Git repository?
Step:- 
1) Create local branch let's say "branch-1"
       git command:
       git checkout -b <branch>
       Example:- 
       $ git checkout -b branch-1
2) Check branch is created and Head point to branch-1
     $ git branch

3) Now push local branch to remote.
    git command: 
     git push -u origin <branch>
     Example:- 
    $ git push -u https://github.com/javaiq/git-commands-test branch-1

Now you can check at git reposirory. 


No comments:

Post a Comment