This approach is common with git-flow and hg-flow for example. Now let’s take the case where you deliberately create a separate branch for a feature you’re developing, and for the sake of this example, you are the only person working on that feature branch. you’ve pushed them to another public repository, or submitted a patch or pull request somewhere. The only time you shouldn’t rebase and should merge instead is if you’ve shared your outstanding commits already with someone else via another mechanism, e.g. ![]() You can also set this as the default behavior in your Preferences if you like:īy taking this approach, when developing in parallel on a shared branch, you and your colleagues can still create a linear history, which is much simpler to read than if each member merges whenever some commits are built in parallel. In SourceTree, you can do this in the Pull dialog: It’s important to note that your commits must not have been shared with others yet. ![]() In other words, you’ll be pulling down other people’s changes and immediately rebasing your commits on top of these latest changes, allowing you to push the combined result back as a linear history. In this case, I would always recommend the ‘Pull with rebase’ approach. With shared branches, several people commit to the same branch, and they find that when pushing, they get an error indicating that someone else has pushed first. To explore this further, let’s say you work in a development team with many committers, and that your team uses both shared branches as well as personal feature branches. Looking at the above pros/cons, it’s clear that it’s generally not a case of choosing between one or the other, but more a case of using each at the appropriate times. In Git, you may push commits you may want to rebase later (as a backup) but only if it’s to a remote branch that only you use. If anyone else checks out that branch and you later rebase it, it’s going to get very confusing. In Mercurial, you simply cannot push commits that you later intend to rebase, because anyone pulling from the remote will get them.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |