![]() Identify the first commit where your personal branch diverged from an existing CEF branch. # Create a new personal branch that will be squashed. # Start with the existing personal branch that contains all of your commits. This second branch can have as many pushes to the remote server as needed.Ĭreate a new personal branch that will be squashed. It will require creating a second branch upon the creation of the fork. Solution 3 To squash your latest commits ,if you want to last 10 commits 1) git reset HEAD 10 2) git add. Change all commits from " pick" to " fixup" but one commit must have " pick"!įound a nice summary of the posted answers. (I'd like to see this generosity in SourceTree) At least, reflog is your friend.A file in a editor program will be automatcally open.Use these commands in the terminal, command prompt or in your cmd: Use -f for force push if it already exists.Īlex said it already in his post: Use the git rebase -i ourbranchname command! git push your changes to your remote branch used for the PR.Do: git rebase -i to move your local branch to the tip of master.Do: git commit to create the single commit message that you want.do git log on the local branch to determine the hash of the non-branch commit preceding the first branch commit.Create a local branch that has everyone's commits.If you are absolutely certain that no one will ever use that specific branch you can do the following: Now you can force push your branch to your own fork of the other project and try to make another pull request. ![]() Source Tree will now rebase the history for you. If you are done with the changes, press "ok" at the right bottom corner. Usually, you also want to change the message of the commit when you squash them together, double click on the message to change it. Sourcetree will update the top screen in response to the actions you did so you can see its doing what you want. Since we want to squash every commit together, we click the top commit and select the button "Squash with previous" at the bottom of the screen. This will open a screen where we can select what to do with every commit. Then a menu will popup, select "interactively rebase children of " At the end I get to edit the final commit message, and it looks right with 1 commit directly off the base commit I rebased onto.Rebasing is easy to do with SourceTree, in sourcetree select the commit that you based your work on, then press the right mouse button. My editor opens up and I 'p'ick the top line and 's'quash for the other three. When I use the command line, I type `git rebase -i `, where is the one I right-click on in source tree. The first commit in the branch where I added 'a' to the file is still there, even though it was listed in the 4 commits that should be squashed together. Looks good, right? So when I hit 'OK' it works, BUT I STILL HAVE 2 COMMITS. Now I right-click on the top line and edit the message and it says '' and the message is my new 'All Changes' message. Now I have 1 line that still says " and 'xxx (+1 squashed commits)', but there are four commits when I expand it. I then right-click on that and squash it, then do it again. That then says and message is 'xxx (+1 squashed commits)'. I right-click on the top 1 and pick 'Squash with previous commit'. So I want to squash them all into 1 commit with all 4 changes in it. I then right-click on the original commit I branched from and picked 'rebase children of xxxx interactively'. I created a 'temp' branch and 4 commits, adding 'a', 'b', 'c', then 'd' to. I can't figure out how the 'rebase children of xxx interactively' works.
0 Comments
Leave a Reply. |