Skip to content

Instantly share code, notes, and snippets.

@santisbon
Last active March 16, 2023 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save santisbon/dbbfa250cf33a9c1a128ee9c0039fbeb to your computer and use it in GitHub Desktop.
Save santisbon/dbbfa250cf33a9c1a128ee9c0039fbeb to your computer and use it in GitHub Desktop.
#Git #merge #conflict

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