Force a Git Conflict [duplicate]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
This question already has an answer here:
Producing a git merge conflict
1 answer
Simulating Conflict in GIT
1 answer
For my Job I make an Introduction Presentation about Git.
I want to show how to resolve merge conflicts. But to do so I need to get a merge conflict. For demonstration purposes I wrote a simple HTML Document in this Document is a Table were the Participants enter there Name. Will this be enough to generate a conflict?
git git-merge
marked as duplicate by Liam, mkasberg, Antwane, j08691, phd Nov 16 '18 at 20:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Producing a git merge conflict
1 answer
Simulating Conflict in GIT
1 answer
For my Job I make an Introduction Presentation about Git.
I want to show how to resolve merge conflicts. But to do so I need to get a merge conflict. For demonstration purposes I wrote a simple HTML Document in this Document is a Table were the Participants enter there Name. Will this be enough to generate a conflict?
git git-merge
marked as duplicate by Liam, mkasberg, Antwane, j08691, phd Nov 16 '18 at 20:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12
add a comment |
This question already has an answer here:
Producing a git merge conflict
1 answer
Simulating Conflict in GIT
1 answer
For my Job I make an Introduction Presentation about Git.
I want to show how to resolve merge conflicts. But to do so I need to get a merge conflict. For demonstration purposes I wrote a simple HTML Document in this Document is a Table were the Participants enter there Name. Will this be enough to generate a conflict?
git git-merge
This question already has an answer here:
Producing a git merge conflict
1 answer
Simulating Conflict in GIT
1 answer
For my Job I make an Introduction Presentation about Git.
I want to show how to resolve merge conflicts. But to do so I need to get a merge conflict. For demonstration purposes I wrote a simple HTML Document in this Document is a Table were the Participants enter there Name. Will this be enough to generate a conflict?
This question already has an answer here:
Producing a git merge conflict
1 answer
Simulating Conflict in GIT
1 answer
git git-merge
git git-merge
asked Nov 16 '18 at 16:31
LimatuzLimatuz
122229
122229
marked as duplicate by Liam, mkasberg, Antwane, j08691, phd Nov 16 '18 at 20:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Liam, mkasberg, Antwane, j08691, phd Nov 16 '18 at 20:12
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12
add a comment |
2
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12
2
2
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12
add a comment |
3 Answers
3
active
oldest
votes
Here is how to generate conflict
# init your repo
git init
# print some text to any given file
echo 'aaa' > a.txt
# commit to the current branch
git add a.txt && git commit -m "Commit1"
# create a new branch
git checkout -b branch1
# add code to the end of the file
echo 'bbb' >> a.txt
# commit to the current branch (b)
git add a.txt && git commit -m "Commit2"
# get back to master branch
git checkout master
# add code to the end of the file
# here the file will still have its original code
echo 'ccc' >> a.txt
# commit to the current branch (master)
git add a.txt && git commit -m "Commit3"
# now when you will try to merge you will have conflict
git merge b
add a comment |
Interesting question :)
Create a new branch with git checkout -b new-branch, edit a line, make a commit.
Switch to the original branch, edit the same line with a different edits, make another commit.
Now git merge new-branch, and you'll a get a merge conflict! :)
add a comment |
There are many kinds of conflicts you can produce. Normally people think of modifying some lines in different ways on separate branches... that's fine. That's one type of conflict. But there are others.
Take a pice of code (some lines from a file) and delete them. Take another branch and modify them. Then merge.
Take a file and remove it. Then go to another branch and edit it. Then merge.
Take a file and rename it. Then go to another branch and rename it some other way. Then merge.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is how to generate conflict
# init your repo
git init
# print some text to any given file
echo 'aaa' > a.txt
# commit to the current branch
git add a.txt && git commit -m "Commit1"
# create a new branch
git checkout -b branch1
# add code to the end of the file
echo 'bbb' >> a.txt
# commit to the current branch (b)
git add a.txt && git commit -m "Commit2"
# get back to master branch
git checkout master
# add code to the end of the file
# here the file will still have its original code
echo 'ccc' >> a.txt
# commit to the current branch (master)
git add a.txt && git commit -m "Commit3"
# now when you will try to merge you will have conflict
git merge b
add a comment |
Here is how to generate conflict
# init your repo
git init
# print some text to any given file
echo 'aaa' > a.txt
# commit to the current branch
git add a.txt && git commit -m "Commit1"
# create a new branch
git checkout -b branch1
# add code to the end of the file
echo 'bbb' >> a.txt
# commit to the current branch (b)
git add a.txt && git commit -m "Commit2"
# get back to master branch
git checkout master
# add code to the end of the file
# here the file will still have its original code
echo 'ccc' >> a.txt
# commit to the current branch (master)
git add a.txt && git commit -m "Commit3"
# now when you will try to merge you will have conflict
git merge b
add a comment |
Here is how to generate conflict
# init your repo
git init
# print some text to any given file
echo 'aaa' > a.txt
# commit to the current branch
git add a.txt && git commit -m "Commit1"
# create a new branch
git checkout -b branch1
# add code to the end of the file
echo 'bbb' >> a.txt
# commit to the current branch (b)
git add a.txt && git commit -m "Commit2"
# get back to master branch
git checkout master
# add code to the end of the file
# here the file will still have its original code
echo 'ccc' >> a.txt
# commit to the current branch (master)
git add a.txt && git commit -m "Commit3"
# now when you will try to merge you will have conflict
git merge b
Here is how to generate conflict
# init your repo
git init
# print some text to any given file
echo 'aaa' > a.txt
# commit to the current branch
git add a.txt && git commit -m "Commit1"
# create a new branch
git checkout -b branch1
# add code to the end of the file
echo 'bbb' >> a.txt
# commit to the current branch (b)
git add a.txt && git commit -m "Commit2"
# get back to master branch
git checkout master
# add code to the end of the file
# here the file will still have its original code
echo 'ccc' >> a.txt
# commit to the current branch (master)
git add a.txt && git commit -m "Commit3"
# now when you will try to merge you will have conflict
git merge b
edited Nov 16 '18 at 17:08
answered Nov 16 '18 at 17:05
CodeWizardCodeWizard
55.8k1271100
55.8k1271100
add a comment |
add a comment |
Interesting question :)
Create a new branch with git checkout -b new-branch, edit a line, make a commit.
Switch to the original branch, edit the same line with a different edits, make another commit.
Now git merge new-branch, and you'll a get a merge conflict! :)
add a comment |
Interesting question :)
Create a new branch with git checkout -b new-branch, edit a line, make a commit.
Switch to the original branch, edit the same line with a different edits, make another commit.
Now git merge new-branch, and you'll a get a merge conflict! :)
add a comment |
Interesting question :)
Create a new branch with git checkout -b new-branch, edit a line, make a commit.
Switch to the original branch, edit the same line with a different edits, make another commit.
Now git merge new-branch, and you'll a get a merge conflict! :)
Interesting question :)
Create a new branch with git checkout -b new-branch, edit a line, make a commit.
Switch to the original branch, edit the same line with a different edits, make another commit.
Now git merge new-branch, and you'll a get a merge conflict! :)
answered Nov 16 '18 at 16:38
kopirokopiro
519210
519210
add a comment |
add a comment |
There are many kinds of conflicts you can produce. Normally people think of modifying some lines in different ways on separate branches... that's fine. That's one type of conflict. But there are others.
Take a pice of code (some lines from a file) and delete them. Take another branch and modify them. Then merge.
Take a file and remove it. Then go to another branch and edit it. Then merge.
Take a file and rename it. Then go to another branch and rename it some other way. Then merge.
add a comment |
There are many kinds of conflicts you can produce. Normally people think of modifying some lines in different ways on separate branches... that's fine. That's one type of conflict. But there are others.
Take a pice of code (some lines from a file) and delete them. Take another branch and modify them. Then merge.
Take a file and remove it. Then go to another branch and edit it. Then merge.
Take a file and rename it. Then go to another branch and rename it some other way. Then merge.
add a comment |
There are many kinds of conflicts you can produce. Normally people think of modifying some lines in different ways on separate branches... that's fine. That's one type of conflict. But there are others.
Take a pice of code (some lines from a file) and delete them. Take another branch and modify them. Then merge.
Take a file and remove it. Then go to another branch and edit it. Then merge.
Take a file and rename it. Then go to another branch and rename it some other way. Then merge.
There are many kinds of conflicts you can produce. Normally people think of modifying some lines in different ways on separate branches... that's fine. That's one type of conflict. But there are others.
Take a pice of code (some lines from a file) and delete them. Take another branch and modify them. Then merge.
Take a file and remove it. Then go to another branch and edit it. Then merge.
Take a file and rename it. Then go to another branch and rename it some other way. Then merge.
answered Nov 16 '18 at 17:04
eftshift0eftshift0
5,9221022
5,9221022
add a comment |
add a comment |
2
Make 2 branches edit the same file in the same place in each branch, try and merge one into the other. simple
– Liam
Nov 16 '18 at 16:33
stackoverflow.com/search?q=%5Bgit%5D+produce+merge+conflict
– phd
Nov 16 '18 at 20:12