git Tutorial
Introduction Installing Git Understanding Git architecture Initializing the new Git respository Cloning new Git repository .git directory in Git repository Viewing Git configuration First time Git configuration Using SSH keys with Git Checking Git status Adding files into staging area in Git Committing changes to the local repository Ignoring files using .gitignore Viewing the history of commits Viewing the file contents in working directory, staging area and repository Viewing difference between files Viewing the history of files Git revert Git Reset git reflog Creating and switching to new branches in Git Viewing existing branches Merging branches Resolving conflicts Rebase Deleting branches Renaming the branch in Git Push Pull Stashing the changes in Git Tags in Git Patches in Git Creating new repository on GitHub Pushing local repository to remote repository like GitHub IntelliJ IDEAResolving conflicts in git
When merging the branches, we often come across the conflicts. When same files are changes in both branches, conflicts occur.Viewing the conflicts
When merging the branch, we get error message saying there is conflict as shown below. We can also view the files that are in conflict using git status command. Below image shows that in both branches ( x and master), file f1.txt has been changed. To view the conflicts in specific file, use below command. Changes made in local copy are shown between
<<<<<<< HEAD and =======.
Changes made in other branch are shown between
======= and >>>>>>>
After resolving the conflict, you have to add the files into staging area and commit the changes. When all conflicts are resolved and committed, merging process is finished. Here is the output of above example.
Web development and Automation testing
solutions delivered!!