Backlog uses cookies to deliver our services. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

Select your PC environment:

In order to proceed with pushing the change to the remote repository, we will have to manually resolve the conflict. Let's execute a pull to acquire the most recent change set from the remote repository.

Windows

Working in tutorial.

Execute a pull by right-clicking on the "tutorial" directory and click pull.

Click Pull from right-click menu.

Working in tutorial.

Click "OK" in the following screen.

Click OK button

Working in tutorial.

We will now see a warning message saying that the automatic merge has failed. Click "Close".

The message "automatic merge failed" comes up

Working in tutorial.

You will be prompted on whether you would like to see the changes in this revision. Click "Yes".

Click Yes button

Working in tutorial.

TortoiseGit is telling us that the automatic merge has failed because "sample.txt" has a merge conflict. Click "OK".

The conflicts have happened.

Working in tutorial.

When you open "sample.txt", you can see markers that have been added by Git to indicate conflicts in that section of the file as shown below.

Git commands even a monkey can understand
add: Register a change in an index
<<<<<<< HEAD
commit: Save the status of an index
=======
pull: Obtain the content of the remote repository
>>>>>>> 17c860612953c0f9d88f313c8dfbf7d858e02e91

We are going to resolve the conflict by accepting both changes and remove the marker.

Git commands even a monkey can understand
add: Register a change in an index
commit: Save the status of an index
pull: Obtain the content of the remote repository

Working in tutorial.

Now that we have resolved the conflict and the content of the file has changed, we will need to initiate a commit. Right click and choose "Commit".

We are now up to date with the latest change from the remote repository.

Completed acquiring the latest changes from the remote repository.

Mac

Working in tutorial.

Execute a pull by clicking "Pull" on the toolbar menu.

Execute pull

Working in tutorial.

Click "OK" in the next screen to proceed.

Click OK button

Working in tutorial.

A dialog will pop up warning us of a merge conflict.

Conflict occurred during the merge.

Working in tutorial.

When you open "sample.txt", you can see markers that have been added by Git to indicate conflicts in that section of the file as shown below.

Git commands even a monkey can understand
add: Register a change in an index
<<<<<<< HEAD
commit: Save the status of an index
=======
pull: Obtain the content of the remote repository
>>>>>>> 17c860612953c0f9d88f313c8dfbf7d858e02e91

We are going to resolve the conflict by accepting both changes and remove the marker.

Git commands even a monkey can understand
add: Register a change in an index
commit: Save the status of an index
pull: Obtain the content of the remote repository

Working in tutorial.

Now that we have resolved the conflict and the content of the file has changed, we will need to initiate a commit. Right click and choose "Commit".

We are now up to date with the latest change from the remote repository.

Completed acquiring the latest changes from the remote repository.

Command Line

Working in tutorial.

Execute the following command

$ git pull origin master
Username:
Password:
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://monkey.backlogtool.com/git/BLGGIT/tutorial.git
* branch master -> FETCH_HEAD
Auto-merging sample.txt
CONFLICT (content): Merge conflict in sample.txt
Automatic merge failed; fix conflicts and then commit the result.

A message should appear warning us of a merge conflict.

Working in tutorial.

When you open "sample.txt", you can see markers that have been added by Git to indicate conflicts in that section of the file as shown below.

Git commands even a monkey can understand
add: Register a change in an index
<<<<<<< HEAD
commit: Save the status of an index
=======
pull: Obtain the content of the remote repository
>>>>>>> 17c860612953c0f9d88f313c8dfbf7d858e02e91

Working in tutorial.

We are going to resolve the conflict by accepting both changes and remove the marker.

Git commands even a monkey can understand
add: Register a change in an index
commit: Save the status of an index
pull: Obtain the content of the remote repository

Working in tutorial.

When you are done editing the file, you will need to commit.

$ git add sample.txt
$ git commit -m "merge"
[master d845b81] merge

We are now up to date with the latest change from the remote repository.

Working in tutorial.

We can verify the accuracy of the repository history using the "log" command. The --graph option will show the branch history in a graph format and the --oneline will try to compact the output message.

$ git log --graph --oneline
* d845b81 merge
|\
| * 4c01823 append description of the pull command
* | 95f15c9 append description of the commit command
|/
* 3da09c1 append description of the add command
* ac56e47 first commit

This indicates that the two histories have been merged successfully with a new merge commit.

We can safely push this change to the remote repository without any merge conflicts.