git checkout featureĪt a high level, rebasing can be understood as “moving the base of a branch onto a different position”. Rather than merging master’s new commits into feature, we opt to rebase our feature branch onto master. We need to get it just right - this change affects 50% of our codebase! But before we continue working on our feature branch, we decide we want to bring in the latest changes from master to keep things fresh. Let’s rewind, and pretend that we instead wanted to keep working on styling the letter ‘b’ - maybe change its size, font, color, etc. As an added bonus, when merges are reserved for these major changes, the merge commits act as milestones that others can use to figure out when these major changes were incorporated into the project. Large refactors and major feature additions are good candidates for separate feature branches that can later be merged into master. Use merge for cases where you want a set of commits to stand out. Avoid branching and merging when only making minor tweaks or trivial bug fixes. To avoid this pitfall, try to use merges purposefully and sparingly. For collaborative workflows in which other developers (and potentially even project managers/leads or QA) read your project’s Git logs for insight and context, readability is important. The downside of merging? If used too liberally, merge commits can clutter up your Git logs, and make it much more difficult to understand the flow of your project’s history. On our feature branch, we have italicized the ‘b’, and then bolded the ‘b’.īy merging feature into master, master obtains a new commit - a “merge commit”.Īll by itself, the merge commit represents every change that has occurred on feature since it branched from master. On the master branch, we have italicized the ‘a’, then bolded the ‘a’. In our project’s Git repository, two branches currently exist: the usual master branch, and a feature branch that we created right after the initial commit. Click the images below if you’d like to watch the two 3-to-4 minute videos explaining the difference or continue on to read about the differences.Ĭlick this link if you’re interested in using
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |