Check out git fetch;git rebase origin/master
or git pull --rebase
, both honor the order of the commits in the master repository because it rebases, sticking local commits on top. You don t care about the order of the local commits as much on local branches anyway because only you have them. Try it out, but use with care, e.g. duplicate a branch before rebasing until you re used to it.
总的来说,你再次谈论了香味工作流程,我发现,你应该熟悉两个一般性的工作流程。 了解我从个人经验中谈论如何尽量减少冲突:
- Rebase-first workflow (for cleanest commit history, pushes the burden of conflicts generally to uncommitted code)
- Merge workflow (sometimes simpler when there are a lot of changes that would conflict, I usually use this only as a fallback)
Example Initial workflow
git checkout master // For the sake of argument, let s say the latest commit in your local master is from august 1st or something old like that.
git branch temp_branch // copy of the master
git checkout temp_branch
git add changedFiles;git commit changedFiles; // A change from november 2nd.
git log // Now your dev branch has a new commit on top of an otherwise old branch.
git log origin/master // You get a listing of the commits from the origin repository, the master branch.
Generally I use origin/master for development staging, with git tags standing for the commits that are made live releases.
Now here s where the problem occurs, and where the choice of workflow comes into play: let s say there s a commit that came from another dev repository up in master, e.g. a commit from october 15th. Maybe it was commited by another developer, maybe by yourself.
你的选择: 合并或重新计算。
Merge
作出额外承诺,为你们的当地(不尽人意)在神学(原产/主)历史中分立的发展中世界历史,给他人和其他分支带来更大的冲突潜力。 基本上,你说,“我的意志与总务局混淆”,而不是重订历史。
git merge origin/master // merge commit introduced
... // Resolve any conflicts, and finalize the merge commit.
git checkout master;git rebase temp_branch // Move the changes to master.
git push origin/master // Pushing changes, including merge commit, to origin/master
最后,承诺的历史将看一看:8月-10月-11月-摩尔格社区
Rebase
当地没有承诺,在运河存放处(原产地/主)已经承诺支付酬金,通常会发生冲突,因为开发商尚未作出承诺(因此,别无一人可以负责)。
git rebase origin/master //
... // Resolve any conflicts...
git rebase --continue or git rebase --abort
... // Resolve any conflicts...
git checkout master;git rebase temp_branch // Get the branch changes without a merge commit into master.
git push // Push all changes to the canonical repository.
注:如果你最终不得不做两个以上的冲突决议——当时是<代码>git rebase——abort<>/code>的良好时机,并回到一起。
了解这一进程,看看它是否对你有用! 在你能够真正掌握有助于你发展的策略之前,我进行一些试验,因为一旦你权力下放,就有更多的办法。