![]() ![]() Optionally, you can choose to push the commits back to the remote repository. You can simply delete those lines and create a new line that describes the update or the bug fix. When you commit, it will give you a prefilled commit message containing all the merged commits. git merge -squash branch-xyzĪt this point you can commit the merged updates. This allows you to commit early and often on the feature branch and only update the main code base as if only one commit happened keeping a nice and clean history. We can now merge the feature branch into master squashing all commits into a single commit. Īt this point, the feature branch is up to date with master, so we can checkout master again to get ready to merge. You may need to repeat these steps as necessary until all rebasing has been completed. To resolve the conflicts, open the conflicting files in an editor and update the demarked lines. If any conflicts occurred while rebasing, you will need to resolve those conflicts before proceeding. If not, make sure to do a git pull on the master branch to bring it up to date. This assumes that master is up to date with your remote repository. This makes it look like the feature branch was copied from the master branch and all commits laid on top, even if other commits happened on the master. This will replay all commits on the feature branch on top of the latest code from the master branch. Step 2: Rebase the branch to the master branch ![]() Step 1: Checkout the feature branch git checkout branch-xyz This assumes you already have a branch named branch-xyz and have finished the work on that branch. ![]() The following is an example workflow for developing on a temporary branch and merging back to the main branch squashing all commits into a single commit. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |