![]() Important: we only use “git pull –rebase” (or -r).Perhaps “git pull –rebase” behaves differently in other versions. We only tested Git v2.14.1 and Git v1.7.2 for this experiment.This is a reasonable assumption since git sets this up by default when a user first types “git checkout feature”. We assume Gabriel has correctly set up remote tracking for his local feature branch.For each scenario, we want to see if Gabriel can use “git pull –rebase” to correctly reconcile his work (his ‘ gf‘ commit) against Evangeline’s most recent push. ![]() Meanwhile, Gabriel has already made his own ‘ gf‘ commit to his local feature branch. In each scenario, Evangeline rewrites the history of origin/feature with a force-push of some kind, usually incorporating her own ‘ ef‘ commit into her push. git commit -m 'gf' -author=' checkout -b evangeline/feature HEAD~1Įcho 'ef' > ef git add. R_ecreate it using the script below.Įcho 'a' > a git add. Note: ‘evangeline/feature’ is actually Evangeline’s local ‘feature’ branch, and ‘gabriel/feature’ is Gabriel’s local ‘feature’ branch. Evangeline and Gabriel are working together on branch ‘feature’. The context is a feature branch that two people are working in parallel, where either person might force-push at any time. The context here is not a master branch that’s advancing. I was unable to confuse “git pull –rebase,” no matter how hard I tried. I tried squashes, merge-squashes, dropped commits, merge-base adjustments, and all sorts of other force-push craziness. Take two commits, look at their patch-ids, and if they’re the same, drop the local one.īut what about squashes and other force-pushes where git patch-id won’t help? What does “git pull -r” do in those cases? I created a series of synthetic force-pushes to find out. Thanks to the git patch-id command it’s easy to imagine how this mechanism might work. are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).’ ‘Note that any commits in HEAD which introduce the same textual changes as a commit in HEAD. The official “git rebase” documentation attests to this: I’ve long known that “git pull –rebase” reconciles the local branch correctly against upstream amends, rebases, and reorderings. Conclusion: Time To Revise The Golden Rule Introduction
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |