You have squashed everything and cleaned up your local commits in step 1. Write a good commit message that summarizes all of your own (local) commit messages, because they are lost. Don't forget the files you added or deleted on the way! Step 3Ĭommit. (If you inadvertedly do a hard reset, you will lose your work.) Step 2 Be sure to check that your reset is mixed. A mixed reset will keep all your changes. That is the commit labeled origin/myfeature. Step 1ĭo a "reset current branch to this commit" on the latest published commit. You can stay within branch myfeature throughout the procedure, so you will not influence anyone else's work. Suppose you are several commits ahead of branch origin/myfeature. Assume you are in local branch myfeature. I use it to create "tidy" commits in the shared repository, while committing frequently in my own local repository. As usual, it only works before making your work public. It is quite simple, after you think of it. This answer works with most versions of Sourcetree on any platform, because I am using old functionality only. Old school Squashing within your own local feature branch To learn more about how to squash commits using the command line, see Squashing Commits, from the FREE online Pro Git book. In the TODO list, put an s (for squash) next to commits to squash into the previous commit: pick e953225 Add meow meow meow You still have the option of using the command line to squash commits: git rebase -i However, the feature doesn't seem to be available in the Windows version of SourceTree, which is currently still at version 1.0.8. Old AnswerĪpparently squashing commits is a feature in SourceTree version 1.6 for the Mac. Just right-click on a commit in the log and choose ‘Rebase children of interactively’ to kick the process off. You can also change the commit message, or edit the content of the commits. Combine (squash) multiple commits together, or re-order them, simply by dragging & dropping. The git rebase –interactive command allows you to reorganise your commits after you’ve created them (but before you’ve made them public), and now you can do this inside SourceTree. Interactive rebase has been available in SourceTree for Mac since version 1.6 (emphasis mine): As of version 1.5, you can now do interactive rebases, which will allow you to squash.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |