“Git how to push to origin repository”的版本间的差异
来自个人维基
free6d1823(讨论 | 贡献) |
free6d1823(讨论 | 贡献) |
||
(未显示1个用户的2个中间版本) | |||
第1行: | 第1行: | ||
− | * Push | + | * Push your changes to the remote repository. |
<source lang="awk"> | <source lang="awk"> | ||
git push origin master | git push origin master | ||
</source> | </source> | ||
− | * Push | + | * Push your changes to the remote repository for review. |
<source lang="awk"> | <source lang="awk"> | ||
git push origin HEAD:refs/for/<branch> | git push origin HEAD:refs/for/<branch> | ||
第12行: | 第12行: | ||
<source lang="awk"> | <source lang="awk"> | ||
git pull --rebase origin master | git pull --rebase origin master | ||
+ | </source> | ||
+ | |||
+ | * 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 | ||
+ | <source lang="awk"> | ||
+ | git status | ||
+ | </source> | ||
+ | |||
+ | To see where the problem is. You edit the conflict files then | ||
+ | <source lang="awk"> | ||
+ | git add <modified-files> | ||
+ | git rebase --confinue | ||
+ | </source> | ||
+ | |||
+ | * Undo rebase | ||
+ | <source lang="awk"> | ||
+ | git rebase --abort | ||
+ | </source> | ||
+ | |||
+ | * After rebase on top of the origin and solving all conflicts, you can publis your changes to remote repository. | ||
+ | <source lang="awk"> | ||
+ | git push origin master | ||
</source> | </source> |
2022年4月11日 (一) 09:07的最后版本
- 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