And that's Time. The picture of an eye with an ancient clock reflecting on it. Listen to the audio version! Have you ever found yourself in a Git mess? If you have a considerable amount of experience in and has been using Git for some time, the answer to this question is most likely to be . programming yes Due to the existence of many commands and complex rules, a messy Git state can be as hard to understand as a badly written application. Even if you have more experience with Git, it won’t be easy to revert a wrong in hindsight unless you know all the steps that created that mess in the first place. rebase If you don't know all the steps — say you’re helping somebody else — the easiest approach is to go back and start over. Reset the state to a working commit and reapply all the changes again, preferably by cherry picking each commit from the . [git reflog](https://git-scm.com/docs/git-reflog) In order to fix a Git mess in hindsight, you need to know all the steps that created that messy state in the first place. Git implements Event Sourcing. Event Sourcing is the same architecture that powers . You can say a commit stores a "committed" event on a Git repository the same way a transaction stores a "confirmed transaction" on the . The difference is that nobody has to wait for the commit to confirm. Bitcoin Blockchain Git is like time. Every time you commit, you’re ticking the clock to move forward. You can go back to the past by the state to a previous point in time. However, if you , you risk changing the future as a side-effect. resetting change the past and go back to the future For that reason, if you change the past, Git will have to create a new timeline and modify the hash of all the commits since the point you changed. Git will ask you to review all the forward changes to make sure they're still in a valid state. It's a way to avoid a " " from happening. forked Temporal Paradox Git's Event Sourcing model is very useful. It makes the system and . secure debuggable If nobody can change the past unnoticed, that means your code will be safe from . If you can go back to the past, that means the code the first time when the problem was introduced. malicious changes you can debug Git is like time. If you change the past, the future will be affected. Git allows high availability. It you to from multiple repositories. Those repositories can be distributed copies of the project so that many people can collaborate through the network. affords read remote . git fetch sam . git fetch mary If one machine is disconnected from the network, either because the developer or by a , the project will still be available and work will continue. got hit by a bus 410 GONE However, most projects use a centralized service like to store the code. They don’t leverage the high availability capabilities of Git. If a , everybody else has to stop. Github centralized server pulls the plug . git fetch origin For many projects, the default remote has become synonymous with . origin Github Git allows decentralization. However, people insist to use it in a centralized way. Similar to , Git is a carefully crafted piece of engineering aimed to be , and . is the core architecture and a is the data structure. It uses many fundamentals of how the world works and turns that into an effective . Bitcoin decentralized secure debuggable Event Sourcing Merkle Tree Source Control System In the past, I've written about . The post tells how developers tend to find problems and blame their tools. However, most of the time the problem is not the tool, but the lack of knowledge of the underlying fundamentals. The Doctor And The Scalpel Git is a perfect example of that. If you don’t understand the fundamentals, you won’t be able to make good decisions on to use its commands and how to reason about its complex rules. Maybe you can memorize what's a , but you’ll be doomed to always find yourself in an irreversible mess the first time you see a code conflict. how git commit Sometimes the best long-term strategy is not to learn how to fix a problem and memorize commands, but have enough knowledge so that you’ll never end up with a mess in the first place. to do it right from the beginning If you don't, at least . the internet has got you covered Thanks for reading. If you have some feedback, reach out to me on , or . Twitter Facebook Github
Share Your Thoughts