How to push changes to branch?

前端 未结 3 1291
再見小時候
再見小時候 2021-01-05 07:36

Can you explain me how to use git in case, when I have access to repository:

  • How to download repository
  • How to push changes in selected branch
3条回答
  •  臣服心动
    2021-01-05 08:01

    3 Steps to Commit your changes

    Suppose you have created a new branch on GitHub with the name feature-branch.

    FETCH

        git pull --all         Pull all remote branches
        git branch -a          List all branches now
    

    Checkout and switch to the feature-branch directory. You can simply copy the branch name from the output of branch -a command above

    git checkout -b feature-branch

    VALIDATE

    Next use the git branch command to see the current branch. It will show feature-branch with * In front of it

    git branch   check current branch
    git status   check the state of your codebase       
    

    COMMIT

    git add .   add all untracked files
    git commit -m "Rafactore code or use your message"
    

    Take update and the push changes on the origin server

     git pull origin feature-branch
     git push origin feature-branch
    

    OR you can rebase with the master before commit

    git fetch
    git rebase origin/master
    git push origin feature-branch
    

提交回复
热议问题