Git Merge

merge {target} incorporates branches by first creating a new commit in the current branch, and then link the target branch’s, or to be merged branch’s, HEAD to the new commit. This results in a web history where the merged branch preserve its origin of divergent and a commit of having two parent commits in the current branch.

Note: When using ^ symbol with commits, be aware whether the commit has multiple parents. See 202205251604#.

It is useful for feature development and bug fixes especially if these are split from a branch. It is similar to 202204261122 but the latter focus on having a linear commit history instead of preserving split and merge points.

Links to this page
  • Git Relative Positioning

    ^ means moving up to one commit or its nearest parent from the current commit. If followed by number, let’s say \(x\), it will point to the \(x\)th parent of the commit in the Git DAG. You can visualise it in git log --graph. This could be useful when dealing with repository that use #202204261123 often.

  • Git Rebase

    It is useful for feature development and bug fixes especially if these are split from a branch. Note the similarity to 202204261123 but the latter focus on preserving the merge history rather than having a clean commit history.

  • Git Pull

    By default, pull is just a shorthand of 202204261123# after #202205251612 from remote repository. Add option --rebase to use 202204261122# instead.

  • Git Fetch

    fetch is a #202205251209 command which downloads remote repository’s commits onto the local repository if there is no merge# conflicts.

  • Git Cherry-Pick

    cherry-pick {commits...} is a powerful tool for introducing individual commit(s) to the current branch without incorporating branches like 202204261122 and 202204261123. The commits will be attached to the HEAD of the current branch in ascending order.

  • Git
#vcs #git