Learning Git Through Small Projects

Mastering version control with C++ and Python experiments.

MartinaMartina
Git Flow Banner

As part of my personal development, I decided to delve deeper into version control systems and chose the popular Git. For practical application, I selected several simple programming projects to familiarize myself with its core functionalities. Specifically, I implemented a few games and algorithms in C++ and Python.

Why code versioning and why Git?

Code versioning is absolutely essential for every programmer. It allows us to track each change, gives the ability to roll back in time if anything goes wrong, helps in collaboration, and acts as a backup. Git is the most widely used system for its flexibility and speed.

Tools Used

I have used Cmder (a terminal emulator for Windows) and GitHub to work with Git. You can learn more about GitHub in my article GitHub: A Beginner’s Guide.

Cmder interface

Basic Git Commands

git init
Initializes a new Git repository in the current directory.
Git init
git clone <url>
Downloads an existing repository from GitHub to your local machine.
git status
Displays the current state of your repository (which files are changed or staged).
Git status and file listing
git add .
Adds changes to the staging area, preparing them for a commit.
git commit -m "description"
Saves your changes to the local repository with a specific message.
Git commit process
git push / git pull
Sends your changes to or pulls new changes from the remote server (GitHub).
Successful git push

Reflection & Challenges

I encountered a challenge with authentication when password-based push was deprecated. I had to switch to Personal Access Tokens (PAT). Another obstacle was managing workflow permissions, which I solved using git update-index --skip-worktree.

"Regular commits with concise descriptions are key. This experience strengthened my knowledge of resolving permission issues and manipulating the Git index."