Coding Challenge #26 - Build Your Own Git Client

Coding Challenge #26 - Build Your Own Git Client

This weeks challenge is to build your own git client.

If You Enjoy Coding Challenges Please Help Spread the Word!

Coding Challenges is 6 months old today!

If you’re enjoying it, please help spread the word.

You can do that by sharing the website - https://codingchallenges.fyi or the substack - https://codingchallenges.substack.com/ or your favourite coding challenge on Hacker News, Reddit or your social media platform of choice. Many thanks in advance for your support!

OK on with the Coding Challange!

As a software engineer, coder, programmer, or whatever you refer to yourself as, I’m sure you’ve heard of the distributed version control system that is git and the hugely popular git hosting service GitHub.

If you’ve not come across git before, I wrote about it recently on LinkedIn here , where I also explained why it’s called git!

This challenge is going to have you build a git client that can: create a new repository, add some commits and push them to GitHub.

Step Zero

This is software engineering so we’re zero-indexed and for this step you’re going to set your environment up ready to begin developing and testing your solution.

I’ll leave you to setup your IDE / editor of choice and programming language of choice.

Once you’ve done that I suggest taking some time to read through the Internals section of the Git SCM website. It’ll take you through the steps needed to manipulate a git repository. If you want to really dig into git you can check out the git source code on GitHub.

Step 1

In this step your goal is to create a basic git client that can initialise an empty git repository. An empty git repo is simply the .git directory with a few files in it, these are:

  • HEAD a reference to the current HEAD.
  • config - the repository’s configuration file, there are some defaults set in it.
  • description - the repository’s description file - the default value is defined in the git source repo .
  • hooks - a directory containing any hooks for the repo.
  • info - a directory that contains the excludes file. We’ll ignore it for this challenge.
  • objects - a directory, this is the object store.
  • refs - a directory.

You can check you implementation by running it and then testing with git itself. For example (I’ve called our git implementation ccgit):

% ccgit init test
initialized empty repository: test
% cd test
% git status
On branch master No commits yet nothing to commit (create/copy files and use "git add" to track)
        

Don’t forget to check if there is already a git repository initialised in the directory.


Continued...

You can find Step 2 and beyond on the?Coding Challenges ?website as?Write Your Own Git

Or if you'd rather get the whole challenge delivered to you inbox every week, you can subscribe on the?Coding Challenges Substack .

Salah Mohammed Al-Saleh

AUM University, B.Sc in IST

1 年

I have built at least 4 out of all of these listed apps. The other apps that I built and developed were of my own endeavours and interests.

Caleb Mellas

Engineering @ Olo | Author of Level Up Software Engineering Newsletter ??

1 年

Building functioning applications is: – Head-banging difficult – Messy – Harder than watching Youtubes But wow, will it help you level up more than getting stuck just watching or reading tutorials. This is the way to really learn and grow. Show up consistently even 15-30 mins a day focusing on learning, and amazing things will happen. (this has been the key in my own journey to final level up into a senior engineering position)

Matthew Kolakowski

Lead System Engineer

1 年

The coding challenges and amount of time you have put into the material are incredible, John.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了