Why do I need to explicitly push a new branch?

前端 未结 8 1551
遥遥无期
遥遥无期 2020-11-22 00:48

I am new in git and I am practicing. I created a local branch but I saw that when I did git push my branch was not uploaded to the repository. I ha

8条回答
  •  遥遥无期
    2020-11-22 01:24

    If you enable to push new changes from your new branch first time. And getting below error:

    *git push -f
    fatal: The current branch Coding_Preparation has no upstream branch.
    

    To push the current branch and set the remote as upstream, use

    git push -u origin new_branch_name
    
    
    ** Successful Result:** 
     git push -u origin Coding_Preparation
    Enumerating objects: 5, done.
    Counting objects: 100% (5/5), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 599 bytes | 599.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote:
    remote: Create a pull request for 'Coding_Preparation' on GitHub by visiting: ...
     * [new branch]      Coding_Preparation -> Coding_Preparation
    Branch 'Coding_Preparation' set up to track remote branch 'Coding_Preparation' from 'origin'.
    

提交回复
热议问题