Git-Sim - Use Git Fearlessly
Written by Nikos Vaggalis   
Thursday, 09 February 2023

Git-Sim enables you to visually simulate future Git operations in your own repos. Let's see why this is useful.

Mastering Git is more an art than a skill. Its vastness in switches, options and features render its comprehension a difficult proposition. Thus, many beginners and not just beginners, find it hard to let their valuable code be handled by this version control system. Questions like 'will somehow my files get corrupted?' or 'should I merge or rebase? will I lose my work?', or ‘when dealing with merge conflict in a large file, how do you find the conflicts?’ or ‘does Git show the two full, different versions of a file or just the differences?’, can keep them awake at night. . .

As to the question ‘when to merge or when to rebase?’, the insightful answer is ‘you will always merge, the question is whether you rebase first’, by master Yoda... But then, what’s the difference between fast forward and recursive merge and how to go about resolving merge conflicts?

Or what about when Renaming, Deleting and Ignoring potentially dangerous operations? 

It's because of its many options that Git is powerful, but at the same time difficult to master. Wouldn't it much easier if there was a playground that would let you test your assumptions without any cost or fear of breaking something?

Wish granted! Enter Git-Sim which makes the claim Visually Simulate Git Operations In Your Own Repos. It's a simulator that helps Git users of all experience levels understand exactly how running a specific Git command will impact their own local repo before running it.

Git-Sim, made by Initial Commit, is a command-line tool written in Python that allows Git users to quickly and easily generate images (or even video animations) illustrating the impact of a Git command will have.

For example, you can simulate a Git merge of the branch dev into the active branch main using the following command:

$ git-sim merge dev

or simulate a git reset of your branch to the previous commit using the following command:

$ git-sim reset HEAD^

Furthermore, these visualizations can be animated using the --animate flag so you can watch your workflow step by step.

The format of the command's invocation is as follows:

$ git-sim [global options] <subcommand> [subcommand options]

The [global options] apply to the git-sim itself, including:

--light-mode: Use a light mode color scheme instead of default dark mode.

--animate: Instead of outputting a static image, animate the Git command behavior in a . mp4 video.

--reverse: Display commit history in the reverse direction.

The simulated Git commands at the time of writing are :

git log
git status
git add
git restore
git commit
git stash
git branch
git tag
git reset
git revert
git merge
git rebase
git cherry-pick

All in all, Git-sim is a true game changer. Now you can use Git fearlessly. If your command does not succeed at first, then swipe the simulator and try again.

Get it with 'pip3 install git-sim'.

 

More Information

Git-Sim 

Related Articles

GitHub Skills - A Better Way to Learn Git and GitHub

First Aid...Git!

Git Command Explorer

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Geoffrey Hinton And The Existential Threat From AI
13/10/2024

As the winner of the Nobel Prize For Physics 2024, Geoffrey Hinton found himself being interviewed multiple times. He used the opportunity to reiterate and explain why he has come to see AI as an exis [ ... ]



GitHub Launches Enterprise Data Residency
30/09/2024

GitHub has announced an option offering tighter control over where data is stored to meet regional requirements. The GitHub Enterprise Cloud data residency feature will launch on October 29 for the Eu [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 09 February 2023 )