Set up GitHub Desktop
GitHub Desktop will help the git user to perform the git-associated tasks graphically. You can quickly download the newest installer of this application for Ubuntu from github.com. You have to set up and configure this software right after down load to use it. You can also verify the tutorial for setting up GitHub Desktop on Ubuntu to know the set up system correctly.
Produce a neighborhood repository
You have to produce a nearby repository to examination commands made use of in this tutorial for checking and solving merge conflict.
Verify the merge conflict:
You can create a new neighborhood repository or any present repository to check the instructions used in this aspect of this tutorial. I have used an current area repository named bash and opened the repository folder from the terminal. Run the pursuing commands to test the present department listing, swap to the learn department, and make a file named setup.txt by utilizing nano editor.
$ git department
$ git checkout grasp
$ nano setup.txt
The next output shows that there are three branches in the repository, and the major branch is energetic at first. Up coming, the energetic department has changed to learn. The nano editor will be opened following executing the ` nano set up.txt ` command.
You can incorporate any articles to the file. The next information has been included in the setup.txt file listed here.
Comply with the instructions…
Run the adhering to instructions to incorporate the setup.txt file in the repository, dedicate the task with the dedicate concept, and verify the current standing of the repository.
$ git include setup.txt
$ git commit -m “set up.txt is extra”
$ git position
The following output shows that one particular file is inserted in the repository with the commit concept, and the working tree is thoroughly clean now for the master branch.
Run the adhering to commands to improve the recent branch to the secondary and open up the nano editor to insert the content material for the setup.txt file that has been edited presently in the master department.
$ git checkout secondary
$ nano setup.txt
The subsequent output will show up immediately after executing the above command.
You can incorporate any written content to the file. The next content has been additional in the setup.txt file listed here.
Browse the instructions…
Run the pursuing instructions to insert the set up.txt file in the repository, commit the endeavor with the commit concept, and look at the present-day status of the repository.
$ git increase setup.txt
$ git commit -m “setup.txt is included for the secondary branch.”
$ git position
The pursuing output shows that the setup.txt file has been additional to the secondary department of the repository.
set up.txt file has been modified in learn and secondary branches. Run the following instructions to swap into the master branch and merge the material of the secondary branch to the grasp branch.
$ git checkout grasp
$ git merge secondary
The following output displays that the merge conflict has appeared mainly because the similar file has been modified in each benches.
Remedy the merge conflict:
Run the adhering to command to look at the material of the set up.txt file in advance of resolving the merge conflict.
The following output demonstrates that the set up.txt file consists of the information added in equally branches with some added symbols. The sevenless figures (<<<<<<<) with HEAD has added before the committed content of the master branch, and the seven equal sign characters (=======) has added before the committed content of the secondary branch. The seven greater than characters (>>>>>>>) has included with the secondary department name at the stop of the file. Here, the considerably less than character indicates the existing branch’s edit. The equivalent indicator suggests the conclude of the to start with edit. The better than character indicates the close of the next edit.
Run the next command to examine the latest status of the repository.
The pursuing output shows that you can abort the merge operation or increase the file yet again just after edit and dedicate the process before executing the merge command once more.
Open up the file in the nano editor and modify the content material based mostly on the need by taking away all symbols.
The following articles has been included to the file by taking away all preceding articles here.
Examine the recommendations properly…
Operate the subsequent commands to insert the file, verify the file’s recent standing, and total the merge procedure.
$ git increase set up.txt
$ git standing
$ git dedicate
The following output displays that the merge conflict has been set, and the secondary department has merged right after executing the `git commit` command.
The ways of detecting and solving the neighborhood merge conflict of the git repository have been demonstrated in this tutorial by applying a demo community repository. I hope the concept of the merge conflict will be cleared for the viewers and will resolve this situation following reading this tutorial.