Git Branch, Merge and Rebase
A Git branch is an independent line of development: a movable pointer to a commit, so work on a feature or fix can go on without affecting the main branch. Branches are combined in one of two ways.
git merge joins two branches with a new merge commit that has both histories as parents; nothing is rewritten, which makes it safe for shared branches. git rebase replays your branch's commits on top of another branch, giving a straight, linear history, but it rewrites commit IDs, so it should not be used on commits others have already pulled. Conflicts are resolved the same way in both.
git switch -c feature/login # create and switch to a branch
git commit -am "Add login form"
git switch main
git merge feature/login # or, on the branch: git rebase main
