Skip to content

Instantly share code, notes, and snippets.

@r1990v
Forked from santisbon/Basic-merge-conflict.md
Created August 11, 2021 06:54
Show Gist options
  • Select an option

  • Save r1990v/abe18f439cf53bb04848f2782877f944 to your computer and use it in GitHub Desktop.

Select an option

Save r1990v/abe18f439cf53bb04848f2782877f944 to your computer and use it in GitHub Desktop.

Basic merge conflict

Go to your local project and fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits will be stored in a local branch, remote_name/branch_name

$ git fetch <remote_name>

Check out the branch you want to merge into e.g. master

$ git checkout <base_branch>

Merge the changes from the feature branch

$ git merge <feature_branch>

If there's a conflict you can view it with

$ git status

Resolve the conflicts manually or with

$ git mergetool

Stage the files to indicate conflicts have been resolved.

$ git add <file>

Commit to finalize the merge

$ git commit -m "Conflicts resolved"

For more info see https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment