4 ms·
As with many things, the solution is complex because the problem is complex. Managing code history in a distributed manner, handling conflicts and allowing coop
by aequitas 6y ago
As with many things, the solution is complex because the problem is complex. Managing code history in a distributed manner, handling conflicts and allowing cooperative coding is not an easy problem to fix.
Having said this, Git doesn't make it easy by the terminology and concepts that are used. And also the inconcise UI (you use git reset for a lot of very different actions, some harmless, some very destructive) doesn't make it easy for a newcomer. Who will often resort to just remember oneliners or look them up from a manual without knowing what they actually do.
What really helped me in understanding Git was to understand the mechanics of the database on an abstract level. Commits and how branches/tags relate to them. If you understand that commits (not branches) are the tree and the branches just post-it's you put on the commits and can rearrange as you please everything becomes much more malleable. Once you discover commits are hardly ever deleted/lost, but just the post-it's are moved (which makes the commits invisible), things become easily recoverable and fixable. Also not using code, but cats[1] also seems to greatly reduced the complexity of learning Git for me. Visual tools like Ungit[2], Tig[3], or plain Git log[4] help to see the commit tree and attached branches and gives an idea of how the data is manipulated.
There is also the Gitless[0] project which tries to redefine the UI of Git, without changing the data format itself. It offers a different look at the same repository and more clear and dedicated commands/concept to perform certain tasks. And since it just uses Git itself underneath you can seamlessly switch between it and Git without issues.
[0] https://gitless.com/ https://gitless.com/
[1] https://girliemac.com/blog/2017/12/26/git-purr/ https://girliemac.com/blog/2017/12/26/git-purr/
[2] https://github.com/FredrikNoren/ungit https://github.com/FredrikNoren/ungit
[3] https://github.com/jonas/tig https://github.com/jonas/tig
[4] git log --oneline --decorate -50 --all --graph --remotes