Merging branches in Git is useful for combining changes from one branch into another, and for preserving history.
Let’s say you have a master branch with changes. You then branch off into a feature branch and make additional changes.
To merge the feature branch, you will want to first checkout your master branch with
git checkout master
Then use the command
git merge feature
You will then merge changes from the feature branch over to master, adding all changes from the feature branch to master. This gives you an accurate representation of the history, in addition to getting all the changes combined onto master.
ProTip: the term “master” is outdated; we recommend using “main” instead when possible.
Setting your default branch name in GitKraken is quick and easy. You can do this when you initialize a new Git repository in GitKraken, or from the Preferences menu.