Git how to push to origin repository

来自个人维基
跳转至: 导航搜索
  • Push your changes to the remote repository.
git push origin master
  • Push your changes to the remote repository for review.
git push origin HEAD:refs/for/<branch>
  • If your local repository is older than the central, you will need to rebase on top of the origin.
git pull --rebase origin master
  • Solving conflicts

Rebasing works by transferring each local commit to the updated main branch one at a time. This means that you catch merge conflicts on a commit-by-commit basis rather than resolving all of them in one massive merge commit.
Git will pause the rebase at current commit and show the conflict message.You can also run

git status

To see where the problem is. You edit the conflict files then

git add <modified-files>
git rebase --confinue
  • Undo rebase
git rebase --abort
  • After rebase on top of the origin and solving all conflicts, you can publis your changes to remote repository.
git push origin master