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


We Built A Software Engineer
20/03/2024

One of the most worrying things about being a programmer today is the threat from AI. It has gone so far that NVIDA CEO Jensen Huang proclaims that you really shouldn't start training as a programmer  [ ... ]



Opaque Systems Introduces Gateway GenAI Solution
14/03/2024

Opaque Systems has announced an early access program for Opaque Gateway, software designed to address data privacy, security, and sovereignty concerns in managing GenAI implementations.


More News

raspberry pi books

 

Comments




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

Last Updated ( Thursday, 09 February 2023 )