Coursera (Practice Quiz: Branching & Merging)
The following script contains the result of a merge conflict. Edit the code to fix the conflict, so that both versions are included. def main(): <<<<<<< HEAD print("Start of program>>>>>>>") ======= print("End of program!") >>>>>>> improvement-to-the-code main()
ANSWER: def main(): print("Start of program>>>>>>>") print("End of program!") OUTPUT: Start of program>>>>>>> End of program! Start of program>>>>>>> End of program! None
The following code snippet represents the result of a merge conflict. Edit the code to fix the conflict and keep the version represented by the current branch. <<<<<<< HEAD print("Keep me!") ======= print("No, keep me instead!") >>>>>>> brancho-cucamonga
ANSWER: Delete everything and keep print("Keep me!")
How do we display a summarized view of the commit history for a repo, showing one line per commit? 1. Git log --format = short 2. Git branch -D <name> 3. Git log --graph --oneline 4. Git checkout -b <branch>
Git log --graph --oneline
What command would we use to throw away a merge, and start over? 1. Git checkout -b <branch> 2. Git merge --abort 3. Git log --graph --oneline 4. Git branch -D <name>
Git merge --abort
When we merge two branches, one of two algorithms is used. If the branches have diverged, which algorithm is used? 1. Three-way merge 2. Fast-forward merge 3. Merge conflict 4. Orphan-creating merge
Three-way merge