lab 14 Creating a Conflict
Goals
- Create a conflicting change in the master branch.
Switch back to master and create a conflict 01
Switch back to the master branch and make this change:
Execute:
git checkout master
File: hello.c
#include <stdio.h> int main(int argc, char *argv[]) { if (argc > 1) { printf("Hello %s!\n",argv[1]); } else { char name[100]; printf("Enter your name>"); scanf("%s",name); printf("Hello %s!\n",name); } return 0; }
Execute:
git add hello.c git commit -m "Made interactive"
View the Branches 02
Execute:
git hist --all
Output:
$ git hist --all * 91098f5 2015-09-29 | Merge branch 'master' into greet (greet) [Jim Weirich] |\ * | 84b2c9d 2015-09-29 | Hello uses greet function [Jim Weirich] * | 2496a1a 2015-09-29 | Added greeter function [Jim Weirich] | | * c40d8ce 2015-09-29 | Made interactive (HEAD -> master) [Jim Weirich] | |/ | * fd8dded 2015-09-29 | Added README [Jim Weirich] |/ * 6f94c46 2015-09-29 | Using argv [Jim Weirich] * ca6ff4c 2015-09-29 | First commit [Jim Weirich]
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 03
The latest change in master conflicts with some existing changes in greet. Next we will resolve those changes.