14 ms·
Git-sim: Visually simulate Git operations in your own repos
- lionkor 4y agoI really like git. I like teaching it to my fellow developers, I frequenty use git cherry-pick, git rebase, multiple remotes, submodules, ontop of the usual "common" git stuff. I found GitExtensions (windows) which I used at my last job to be VERY useful, as it is git, properly, the way it was designed, but in GUI format. It taught me a lot about how to actually use git. Now I dont use the GUI, its too slow to click around when I know the command. I dont get the git hate. Then again, I also dont get the "C++ is too complex/complicated" debate, either, so maybe I just have a higher tolerance for terrible design. Or maybe git just is a very powerful tool and takes more than half a year of half-assed use to learn. Teaching some basic things like rebase vs. merge, how to git bisect, how to pull with rebase, update a branch with rebase before merging it, stashing changes, etc. got me and the team I lead at $CURRENT_WORKPLACE very, very far. I can recommend to stop complaining about git, find someone who knows how to use it, and just ask until you get it. Its worth it
- Oxidation 4y ago> Or maybe git just is a very powerful tool and takes more than half a year of half-assed use to learn. And also distributed version control is complicated. Git isn't as intuitive on the happy paths as perhaps it could have been and shows its slightly rushed initial development, but no tool that allows such flexibility can ever be truly simple. And in its defense, it wasn't originally designed to be a super-simple glossy tool. The technical advantages of it simply outweighed the slightly clunky interface, and that interface has improved since then. I do recommend to use the "git lola" alias to give an easy gestalt of the repo state if you're ever unsure what's going on.
- spyremeown 4y agoThis is really good! I generally have a good mental model of my repo and I try to KISS as much as possible, but I can see the value of this in a teaching scenario, for example (as well as on extremely complex git situations). Check out the quickstart page as well, seems to have more content[1]. [1] https://initialcommit.com/tools/git-sim https://initialcommit.com/tools/git-sim
- initialcommit 4y agoHaha wow you posted this before I could! I created Git-Sim and hope that folks can get some use and value out of it. Happy to answer any questions anyone might have, and especially looking for feedback so that I can improve the tool. Also if anyone is interested in contributing let me know and also check out the project Github page: https://github.com/initialcommit-com/git-sim https://github.com/initialcommit-com/git-sim
- eurasiantiger 4y agoThe animation would be clearer if there was also an annotation of what was happening at each moment.
- initialcommit 4y agoInteresting thought - do you mean like a line of text that displayed above that verbally described what's happening? I was considering adding some more detailed text-based output on the command-line detailing what was going on, but I didn't think about adding it directly into the image/video.
- eurasiantiger 4y agoExactly that. For example, the HEAD tag moving to another commit doesn’t mean much if a developer doesn’t know what HEAD is or what git reset does.
- jerpint 4y agoI think it would be helpful in the blog post to list the series of changes happening to the files before the animations
- initialcommit 4y agoGood suggestion, I will add that.
- prettyStandard 4y agoThis looks fantastic! I think this is what we need more of for new git users. I struggled for the longest with git until I came across learngitbranching[0]. I believe having an interactive/visual experience while I typed in commands is what I needed, and what most people need. I tell junior developers they should take a day to learn this and more often than not they dismiss me. Meanwhile these people will run into git conflicts or something and their strategy is to "save their work somewhere else and redownload the repo"[1]. I know of a "senior developer" that will do that. I basically told him, in my eyes, if you don't know how to use git, you are not a senior. Or a bad senior at a minimum. See the stack overflow survey. Git is used basically by all developers. How do you expect to be a good developer by dismissing such a ubiquitous tool. I think I can make an exception for people who aren't using git at their current company and any company before. [0]: https://learngitbranching.js.org/ https://learngitbranching.js.org/ [1]: https://xkcd.com/1597/ https://xkcd.com/1597/
- enriquto 4y ago> save their work somewhere else and redownload the repo Not that there's anything wrong with that, is there? As a "bad senior developer" who uses git daily, one of the things that I love about git is that in the end everything is regular files. So there's nothing wrong with just copying your git repository elsewhere, re-cloning it, and fixing your fuckup by hand. No need to feel guilty about it. Your comment sounds like criticizing somebody that does not know all the keyboard shortcuts that you do.
- prettyStandard 4y agoDo you understand how merge conflicts happen in the first place? If you are to be a senior leading others, you should be able to explain this to juniors so they don't shoot themselves in the foot. Do you disagree that it's a fundamental tool to being a developer(today), or do you disagree that it's necessary to know fundamental developer tools to be a good senior developer?
- maccard 4y ago
- badpromptngnir 4y agoTrying to install it right now and wow it is taking some time. Running 'brew install Pango scipy' is taking more than 5 minutes(still counting). I knows its a one time process but still. The number of dependencies can be reduced I guess.
- initialcommit 4y agoHey there fellow Mac user! And thanks for testing it out - were you able to get it installed or is it still chugging along? Yes I feel your pain with Homebrew which can take forever just to check for updates on installed packages, before it even gets to installing anything new. I know the current installation method of having to first install Manim's dependencies is not ideal, but in most of my testing it was relatively painless. However going forward I am going to be looking for ways to make it a single install instead of various steps that differ across platforms.
- jerpint 4y agoI saw the video and instantly recognized the manim style, it looks great!
- initialcommit 4y agoManim rocks.
- badpromptngnir 4y agoYes, i am testing it now. So far seems good, initially i was getting some very slow animation times but adding the `--low-quality` flag seems to work well. I am planning to do an internal session in my company on Git, and will be using this tool to help them visualise some of the concepts :)
- initialcommit 4y agoSweet! Yeah the slow animation is a Manim performance limitation, I think (hope) their community is working on improving that. Yes --low-quality works for testing but the fastest way would be to first test without the --animate flag at all, so you just get a final image of the command's effect. Then once you get that you can add the --animate flag to generate your final video to share. And awesome to hear it will be used for your company session! I love teaching people about Git. Feel free to share the tool with them so they can try it out as well!
- yeputons 4y agoLooks great! I'm really missing support for remotes. There are lots of tools for local-only development (like https://gitexercises.fracz.com/ https://gitexercises.fracz.com/), but very few allow to demonstrate stuff like "Syncing a GitHub fork with the original repository" which involves two remotes and three copies of the same branch at the very least.
- initialcommit 4y agoThis is a great point. I thought about how I could simulate commands like "git pull" and "git push", but like you said that would require communicating with the remote to determine ... stuff ... like what objects need to be synched, and potentially even doing some of the actual data transfer before an accurate simulation would be possible. My initial goals for this tool are to purely simulate actions on Git repos without actually modifying them, but I might be flexible on that going forward, as I mention in the article with the --execute flag.
- capableweb 4y ago> simulate actions on Git repos without actually modifying them One way around this could be to create a new temporary directory in /tmp, copy .git over there and symlink the rest, then run whatever operation in the newly copied workspace and compare it with the original. Then you can mutate things however you want and the original stays the same.
- initialcommit 4y agoHey cool idea! I'll definitely consider that and variations on it. This could work for Pull-direction operations like fetch/pull, but maybe not as well for push since the remote would still be affected in some way. Will need to think about it more...
- jfcnotagain 4y agoYou can push to a folder too. So you can just do the same thing. Clone the remote into a folder and push into it.
- lumb63 4y agoThis looks promising as a teaching aide. At my previous company, I transitioned our project from Clearcase to Git to save us licensing and administration fees. Many of the senior developers, who had never used Git, had a hard time understanding it, and I spent many whiteboard sessions explaining by drawing similar graphs. This would give those developers more autonomy, and stop the “let me blow it away and start over”, which would drive me nuts. Devs spent a lot of time and frustration performing that operation. I believe the core issue is devs like above never take the time to “grok” Git. I believe part of this is due to the lack of a tool like above to teach easily, but also because devs want to ignore the “how” of their tool working to find out the exact commands they need to run in their current situation. One could argue users should not need to understand how their tool works to use it effectively and this is a leaky abstraction. Others could argue some commands are not intuitive (git reset can do many things, and git rebase swapping ours/theirs comes to mind). I don’t claim Git is perfect, and sometimes I need to Google to learn more than I wanted to, to get out of an obscure scenario (e.g. someone put classified intelligence into a repository we need to transfer to a lower classification network; how do I rewrite the entire history while correcting this error that occurred 487 commits ago?). However, understanding the tree structure of Git, what git rebase does under the covers, what branches and tags are, how remotes work, how merging works, etc. would go a LONG way. The folk I worked with struggled to pick it up.
- capableweb 4y ago> I believe the core issue is devs like above never take the time to “grok” Git I believe the same, and it's not just a problem you see with git, it's all over the place. Some developers seems eager to use something so they just skim the documentation in order to do the least amount of reading and understanding in order to implement something, but often miss some fundamental detail and have to jump back. Or, they fundamentally misunderstand the tool at all, but push forward with their own idea what the tool is, rather than stepping back and start learning again.
- wpietri 4y agoYou say that like it's bad, but that's just life. We're trying to fit a whole universe into 3 pounds of meat. If we stopped to truly understand anything before taking action, we'd never get anywhere. That's especially true in technology, where whole armies of people are working to complicate things as fast as possible. For the best of reasons, of course. But when I started out, I could read one short book and have a pretty good understanding of my computer's processor, and from there it wasn't much further to understanding the whole computer. Now I could spend days just understanding, say, processor cache strategies [1]. A field that is super interesting, but if I am to get any of my actual work done, I can't afford to dig into that and the many, many other similar subtopics. I'm going to get a casual understanding of something, do my best to make something useful, and only dig in further when I'm forced to. When I do have to dig in, it comes in two cases for me. One is where there is something necessary complexity that I would have to learn about regardless. E.g., if something is too slow, I need to learn about what happens under the hood to do proper performance tuning. Great, fine, I will learn it. But then there's the other bucket, which includes unnecessary complexity, bad abstractions, poorly considered UX, and the like. For me, git is clearly in that bucket. I intentionally have very simple development flows. Git can do a great deal, 98% of which I not only don't need, I actively don't want. [2] So I'm going do my best to remain ignorant of its inner workings, stick with my small number of commands, and very occasionally refer to "Oh Shit, Git!?!" [3] And I'm perfectly happy with that until it gets replaced with a technology that better matches the domain. [1] e.g.: https://chipsandcheese.com/2022/05/21/igpu-cache-setups-compared-including-m1/ https://chipsandcheese.com/2022/05/21/igpu-cache-setups-comp... [2] An example of what I don't want: https://www.tiktok.com/t/ZTRpPPuKf/ https://www.tiktok.com/t/ZTRpPPuKf/ [3] https://ohshitgit.com/ https://ohshitgit.com/
- garganzol 4y agoThis is why I'm in love with Mercurial. It has a very simple mental model which is not far from Git, but Mercurial's commands and presentation are so much more comprehensible.
- dgfitz 4y agoEvery time I see a thread like this I echo the same sentiments. It’s not hard to grok how hg works, git adds more mental cycles which just take away from solving the actual problem at hand
- initialcommit 4y agoNice I need to find some time to actually sit down with Mercurial for a nice summer afternoon
- skulk 4y agoI want to pile on here; I switched to Mercurial for some projects and didn't think much of it (had to look up equivalents of some git commands here and there). However, after 2 years of that, coming back to git made me feel like a total newbie. I recently got myself into a detached HEAD state and felt like I was groping in the dark with "git reset". I never had this issue with mercurial, even with weird botched evolve/content-divergent states.
- Already__Taken 4y agoIssues with mercurial like that just throw python stack traces at you and say good luck. mercurial isn't good enough to be special from everyone else using git. it's like using your own keyboard layout, of course you can. but there's a cost for not really a good reason.
- deleted 4y ago[deleted]
- quietbritishjim 4y ago
- mgsloan2 4y agoPretty cool! One idea I really like for avoiding VCS operation anxiety for beginners and experts alike is a filesystem layer that allows revert to any historical state. You just have your bash prompt output the current snapshot number, and then can use that as the revert target if there's a botched rebase or so. Unfortunately I do not know of a nicely packaged way to do this, or how to do it at all with OSS tools (but I bet it is feasible!).
- tempodox 4y agoI've had VCS operation anxiety since the days of CVS. With Subversion it was largely a non-issue but Git made it return with a vengeance. This tool will presumably calm my frayed nerves.
- mdaniel 4y ago> You just have your bash prompt output the current snapshot number, and then can use that as the revert target if there's a botched rebase or so. That is what the ref-log is designed to do, but in my experience with git the risk is not about getting historical content, because git is very good about that: it's the current operation that's the risk If I had any advice for beginners, it'd be to commit early and often, because git is disciplined about managing commits, but is a razor blade about anything in the working copy. There is no ref-log for "but I just typed that..." unless you told git to save it in something with a sha
- mgsloan2 4y agoYeah, but ref-log is scary to beginners (I suppose rebase is too!). Rebase was a poor example, but even so, it is way easier to copy a snapshot number out of your cli and restore than it is to dig through your reflog for the right sha ref-log doesn't save you in so many situations. As you point out, you have to commit all the time for it to save you. Even then, git repo corruption is possible and then you are hosed. For example: * a hard reset clears your working copy changes * you pop a stash you didn't mean to, atop your working copy changes. Now your working copy changes are intermixed with the stash and you have to manually decouple them. * you accidentally stage hunks to your index and its tricky to unstage them because they are adjacent to other hunks Such a tool also saves you from accidentally saving over your work in the text editor. It generally makes it so that you don't need to be as careful. So, generally, git commands that affect your working copy are not undo-able and can be very time consuming to undo if you have no proper time machine underneath your repo. I happily have experienced the bliss of having this reassurance, but it is only within a proprietary env.
- user3939382 4y agoIt doesn't matter how much I look at them, and I get the reasoning, but the right->left flow orientation of VCS diagrams will always be disorienting for me.
- initialcommit 4y agoYou can use the --reverse flag to reverse the direction of the graphs in Git-Sim. However the fact that time flows in the opposite direction of the parent/child relationships, is inevitable based on Git's design.
- mpolichette 4y agoI always have to remind myself that they’re dependency arrows and not a sequence ordering. They make it look like it flows right to left even though time (or at least sequence) flows left to right.
- mooneater 4y agoIts... cool? Alternative would be: clone the repo, do your changes, run gitk to be sure. Which has advantage that result looks exactly the same as it will in production (no new diagram type b/c only using git and gitk), with zero risk that sim differs from reality.
- initialcommit 4y agoEw clone a repo to simulate a command?! Hehe jk you make a fair point, and in fact I do have a bunch of work left to do to make sure my simulations do match up with Git's behavior as closely as possible. One big benefit I was going for with Git-Sim though is to interrupt the developer workflow as little as possible. Changing directories, running a new clone (which could take a mildly annoying amount of time), and running gitk is a pretty big context-switch.
- psychoslave 4y ago- Dear padawan, here is your powerful elegant lightsaber. Yes, it can cut the vegetables you eat on a daily basis. You can even cut your hands easily with it. That's why I'll teach you the art of forecasting most probable outcomes of your next moves when you are using it. - Thank you Master, finally I see the light and understand the the fork or chopsticks dilemma is a fallacy. Millions of jedi knights can't be wrong after all.
- deleted 4y ago[deleted]
- xwowsersx 4y agoI have always wanted something like this. Will be giving this a try. Nice work!
- xwowsersx 4y agoI tried to get manim and its dependencies installed and ran into some issues: error: subprocess-exited-with-error × Building wheel for manimpango (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [27 lines of output] Error in sitecustomize; set PYTHONVERBOSE for traceback: AssertionError: running bdist_wheel running build running build_py creating build creating build/lib.macosx-13-arm64-cpython-310 creating build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/_version.py -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/__init__.py -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/utils.py -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/cmanimpango.pxd -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/cairo.pxd -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/register_font.pxd -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/pango.pxd -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/glib.pxd -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/enums.pyx -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/register_font.pyx -> build/lib.macosx-13-arm64-cpython-310/manimpango copying manimpango/cmanimpango.pyx -> build/lib.macosx-13-arm64-cpython-310/manimpango running build_ext building 'manimpango.cmanimpango' extension creating build/temp.macosx-13-arm64-cpython-310 creating build/temp.macosx-13-arm64-cpython-310/manimpango clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/homebrew/opt/openssl/include -I/opt/homebrew/Cellar/pango/1.50.12/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/6.0.0_1/include/harfbuzz -I/opt/homebrew/Cellar/pango/1.50.12/include/pango-1.0 -I/opt/homebrew/Cellar/glib/2.74.5/include -I/opt/homebrew/Cellar/fribidi/1.0.12/include/fribidi -I/opt/homebrew/Cellar/harfbuzz/6.0.0_1/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo -I/opt/homebrew/Cellar/glib/2.74.5/include -I/opt/homebrew/Cellar/glib/2.74.5/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.74.5/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.42/include -I/opt/homebrew/Cellar/pixman/0.42.2/include/pixman-1 -I/opt/homebrew/Cellar/fontconfig/2.14.1/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16 -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxrender/0.9.11/include -I/opt/homebrew/Cellar/libxext/1.3.5/include -I/opt/homebrew/Cellar/libx11/1.8.3/include -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxau/1.0.11/include -I/opt/homebrew/Cellar/libxdmcp/1.1.4/include -I/opt/homebrew/Cellar/xorgproto/2022.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/ffi -I/opt/homebrew/Cellar/pango/1.50.12/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/6.0.0_1/include/harfbuzz -I/opt/homebrew/Cellar/pango/1.50.12/include/pango-1.0 -I/opt/homebrew/Cellar/glib/2.74.5/include -I/opt/homebrew/Cellar/fribidi/1.0.12/include/fribidi -I/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo -I/opt/homebrew/Cellar/pixman/0.42.2/include/pixman-1 -I/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16 -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxrender/0.9.11/include -I/opt/homebrew/Cellar/libxext/1.3.5/include -I/opt/homebrew/Cellar/libx11/1.8.3/include -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxau/1.0.11/include -I/opt/homebrew/Cellar/libxdmcp/1.1.4/include -I/opt/homebrew/Cellar/glib/2.74.5/include -I/opt/homebrew/Cellar/harfbuzz/6.0.0_1/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/glib/2.74.5/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.74.5/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.42/include -I/opt/homebrew/Cellar/fontconfig/2.14.1/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/xorgproto/2022.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/ffi -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c manimpango/cmanimpango.c -o build/temp.macosx-13-arm64-cpython-310/manimpango/cmanimpango.o clang: error: no such file or directory: 'manimpango/cmanimpango.c' clang: error: no input files error: command '/usr/bin/clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for manimpango Building wheel for srt (setup.py) ... done Created wheel for srt: filename=srt-3.5.2-py3-none-any.whl size=22467 sha256=ef7a967b7b3225064d5e8eecf84934ec066e759d288fcddbe104d26954b1df35 Stored in directory: /Users/me/Library/Caches/pip/wheels/2b/4a/52/216182e898297499cfe0947127f551712c4169ea2e69bcf9d7 Successfully built click-default-group srt Failed to build manimpango ERROR: Could not build wheels for manimpango, which is required to install pyproject.toml-based projects I'm not sure what the underlying problem is here. Anyone have any ideas?
- deleted 4y ago[deleted]
- stavros 4y agoThis is the best tool I'll use once and then never the name of again.
- voxelghost 4y agoSuggestions; 1. In the static output, put a dashed, or shadowed marker corresponding "frame 0" of the animation, e.g. in the git reset example, show where "HEAD" was before (perhaps even add an arrow) 2. Make it possible to 'remember' a set progress, of git commands - and replay them. (I.e. simulation looks ok, now apply them on real git) 3. Make it possible to visualize actual git log in the same style as simulation.
- methods21 4y agoNext HN post - "I destroyed my repo - but it WORKED in Git-Sim!"