Harry Yates
I'm a web developer focused on TypeScript, React, and Three.js.
If you’re a developer, mastering Git is a must. It’s the backbone of version control, enabling you to track changes, collaborate seamlessly, and roll back mistakes.
Command: git init
What It Does: Creates a new Git repository in your project’s directory. Think of it as starting a scrapbook where all your coding history will be documented.
Command: git status
What It Does: Tells you the status of your files in the working directory and staging area. Are they tracked? Untracked? Modified? This command gives you the lowdown.
Command: git add
What It Does: Stages your changes, getting them ready to be committed. It’s like tagging photos in your scrapbook that you want to glue down.
Command: git commit -m "Your message"
What It Does: Records your changes in the repository with a message. Consider it as writing a caption for a page in your scrapbook.
Command: git log
What It Does: Shows the commit history of your project. Each entry is like a page in your scrapbook with detailed captions.
Command: git branch
What It Does: Lists, creates, or deletes branches. Branches are like parallel universes where you can make changes without affecting the main storyline.
Command: git checkout
What It Does: Switches between branches. It’s like flipping through different pages of your scrapbook to work on various parts of your project.
Command: git merge
What It Does: Combines changes from different branches. Imagine merging two scrapbooks into one, ensuring all your favourite moments are captured together.
Command: git clone
What It Does: Creates a copy of an existing repository. Perfect for starting work on a project that already exists.
Command: git push
What It Does: Uploads your local changes to a remote repository. Think of it as sharing your scrapbook online for everyone to see.
Command: git pull
What It Does: Fetches and merges changes from a remote repository to your local repository. Stay updated with the latest scrapbook pages from your friends.
Command: Manually resolve conflicts, then use git add and git commit
What It Does: Sometimes, merging can cause conflicts. You’ll need to resolve these by editing the conflicting files, then staging and committing the resolved files.
Command: git diff
What It Does: Shows the differences between commits, branches, or your working directory and the repository. Like spotting differences between scrapbook pages.
Command: git rebase
What It Does: Reapplies commits on top of another base tip. This command is useful for maintaining a clean project history by integrating changes from one branch into another.
Git might seem like a complex tool, but once you get the hang of these essential commands, you’ll find it incredibly empowering. Version control, collaboration, and project management become a breeze.