When code is mostly appended at the end of things, you will more frequently end
up with git merge conflicts. This problem is quite easy to illustrate.
Bob starts work on a wholly unnecessary maths library for Clojure:
(ns maths.core)
(defn add [a b]
(+ a b))
(defn modulo [a b]
(mod a b))
He commits and pushes this code. Sally clones the upstream repo, and adds a
multiply
function:
(ns maths.core)
(defn add [a b]
(+ a b))
(defn modulo [a b]
(mod a b))
(defn multiply [a b]
(* a b))
Meanwhile, Bob is hard at work on the divide
function:
(ns maths.core)
(defn add [a b]
(+ a b))
(defn modulo [a b]
(mod a b))
(defn divide [a b]
(/ a b))
Sally finishes, commits, and pushes. When Bob tries to push his addition, git
stops him. He pulls with a rebase, and BAM! Git presents him with a conflict:
(ns maths.core)
(defn add [a b]
(+ a b))
(defn modulo [a b]
(mod a b))
<<<<<<< HEAD
(defn multiply [a b]
(* a b))
=======
(defn divide [a b]
(/ a b))
>>>>>>> Add division
Because Sally and Bob both appended their code at the end of the file, the
unlucky one to push last is left to figure out how it all fits together.