I think this analogy is not actually that bad, but you are making some incorrect conclusions from it especially regarding 'junk' DNA and which parts of a repository DNA holds (which shows the limits of analogy!). Think instead of the DNA of an organism as a single local copy of a particular commit.
There is no remote to compare to and no list of historical changes, each organism just has its own local copy of the most recent source that can sometimes be merged with other local copies via sexual reproduction or horizontal gene transfer.
What you need to drop from the analogy
Get rid of any thought of a master branch or ideas that the repository contains backups of previous versions. These thoughts will only mislead you.
original DNA was not erased, but backed up every time new mutation (commit in software SCCS) appeared.
makes little to no sense in biology. There is no backup, except in that each organism is a branch of it's parent(s) source.
Where the analogy could work
Genomes of different species are all branches from some original source code. Therefore, you find a lot of commonality when you compare even very distantly related life, especially in the most key libraries that are involved. There is a ton of conserved sequence in the basic machinery for replicating DNA and producing proteins, for example.
This is why your statement:
This explains why human DNA is mostly so similar to dog DNA, fish DNA etc. Because we all evolved from same primitive cells! Base of our "repository" was same!
is mostly correct.
Length of source
Your analogy has gotten some criticism for your conclusion:
Theoretically, the more primitive organism is, the shorter DNA it should have.
but I would argue this is actually a way in which your analogy works, yet your conclusion from it does not. Software development involves both adding new code and deleting obsolete code. Lines of code is a poor measure of how primitive some code is. Biology shows this well: all life is equally primitive in terms of years of existence, and single-celled organisms are much more advanced in terms of numbers of generations. If organisms contained some log of all the past changes (which they do not), the repository would be way way bigger in bacteria than in animals because of that large number of generations.
In summary, analogy can be helpful to wrap your head around some information, but be careful in taking it too far. Sometimes analogy is good for generating new hypotheses and for guiding your learning, but you need to verify those hypotheses in the actual biology (see Richland and Simms 2015 for one take on the usefulness of analogy as an educational tool).
I disagree strongly with the comment by @SPr stating "The analogy between the genome and source code repository is unhelpful and poor": even the imperfection in an analogy can be very helpful in that they help you build a relational map of the world by finding where analogies work and where they conflict.
Richland, L. E., & Simms, N. (2015). Analogy, higher order thinking, and education. Wiley Interdisciplinary Reviews: Cognitive Science, 6(2), 177-192.