Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. How to use Git
  6. How to use Git on Mac
  7. Make a conflict
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Make a conflict

When a conflict arises, you will need to resolve it to complete your work. In this step, we are going to deliberately create a conflict using our two existing repositories, “tutorial” and “tutorial2”.

First, open the sample.txt file in the tutorial directory on your machine. Add the bold text below to the file and commit.

Anyone can learn Git with this tutorial and Backlog


add: Register a change in an index commit: Save the status of an index

Record the status of commit index

Next, open the sample.txt file in the tutorial2 directory. Add the bold text below to the file and commit.

Anyone can learn Git with this tutorial and Backlog


add: Register a change in an index pull: Obtain the content of the remote repository

pull Acquire the contents of a remote repository.

Now push the change from tutorial2 to the remote repository.

push the change from tutorial2 to the remote repository

In our current remote repository, the sample.txt file contains the third line pull: Obtain the content of the remote repository and has been committed in the history log.

Next, we will push the commit from our tutorial repository to the remote repository.

Git raises a conflict and rejects your push

As you can see, Git raises a conflict and rejects your push.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life