Git - Creating a Conflict

From EdWiki

GitLab - Creating a Conflict

  • Goals
    Create a conflicting change in the master branch.
  • Switch back to master and create a conflict
    Switch back to the master branch and make this change:
git checkout master
  • File: src/hello.c
    Author  : J.Shankarappa (
#include <stdio.h>
#include <stdlib.h>
char my_name[80];
int main(int argc, char* argv[]) {
    if( argc > 1 ) {
        puts("What's your name?");
        scanf("%s", my_name);
        printf("Hello, %s", my_name);
    } else {
        puts("Hello World!!!"); /* prints !!!Hello World!!! */
    return EXIT_SUCCESS;
git add src/hello.c 
git commit -m "Made interactive"
  • View the Branches
git hist --all

Master at commit “Added README” has been merged to the greet branch, but there is now an additional commit on master that has not been merged back to greet.

  • Up Next
    The latest change in master conflicts with some existing changes in greet. Next we will resolve those changes.