Make sure your branch is up to date, Go on develop, get latest and merge and resolve any conflicts with "my_new_feature" If you are on a branch lets call it "my_new_feature" off develop and your pull request has 35 commits (or however many) and you want it to be 1.Ī. Saved my life, and will be my go to squash, been using this 4 times since I found out about it. If you are the average Joe smo, try this: How to use git merge -squash? Have faith that this is the smallest possible number of conflicts as you're skipping the many in-between commits you've originally created.Īll this git reset, hard, soft, and everything else mentioned here is probably working (it didn't for me) if you do the steps correctly and some sort of a genie. You might be getting a smaller number of unavoidable merge conflicts. Ignore and override origin/feature (then clean up)įelix points out that this is going to produce the cleanest possible merge, without any weird self-conflicts coming from a messy/complicated relationship between master and feature:.git checkout $feature & git reset -hard tmp.Checkout feature and git reset -hard tmp ( feature's original contents are gone, and it is now basically tmp, but renamed).tmp is now master + 1 commit (containing all changes). (This is the only step you cannot have a script do for you).Manually solve all remaining "real conflicts".Merge all feature changes into tmp (without any commits, only staged file changes).git checkout master & git pull & git checkout -b tmp.Create a local tmp branch of off master.This is my slightly shorter transcription of his advice: ![]() I found Felix Rieseberg's solution to be the best. How to squash messy branches? Use a temporary branch! This I found to be one of the most annoying issues to deal with. ![]() I often end up having master commits on my feature branch (call it feature) that cause conflicts against themselves. In previous answers, I have not seen any information on how to deal with " messy branches" and " self conflicts". automatically uses the branch you are currently on.Īnd if you use that, you can also use an alias, as the command doesn't rely on the branch name. force"įor the reset, you can do git reset $(git merge-base master $(git rev-parse -abbrev-ref HEAD))
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |