Session - Conflicts!
Conflicts can happen when you merge a branch and can occur when working with others, or even yourself!
Let’s create a conflict…
usethis::pr_init("author_change")
author: Person A
and Rendergert::git_commit_all("Added Person A as author")
usethis::pr_push()
main
using Merge pull request
and do the mergeNot pulling from main
We’ll miss the pr_finish()
part because this function reduces the possibility of conflict as it pulls
changes made on main
… create another branch in RStudio, not {usethis}, as we miss the steps that reduce conflicts:
main
branch using the RStudio Git paneperson-b
author: Person B
and Rendermain
using Merge pull request
and do the mergeTo resolve the conflict we need to edit (in this case delete) one of the names and also delete all the merge text:
This can be done in GitHub and ends with a new commit.
To see the same conflicted files locally:
person-b
)Console
($) and type usethis::pr_merge_main()
✔ Pushing local 'author_change' branch to 'origin/author_change'.
• Create PR at link given below
✔ Opening URL 'https://github.com/Letxuga007/project/compare/author_change'
> usethis::pr_merge_main()
✔ Pulling changes from 'origin/main'.
Merge has resulted in merge conflict(s).
There are 1 conflicted files:
* 'my_report.qmd'
Are you ready to sort this out?
If so, we will open the conflicted files for you to edit.
1: Yes, I'm ready to resolve the merge conflicts.
2: No, I want to abort this merge.
Selection: