Welcome to the not-so-secret society of Git wizards! 🧙♂️🔮 If you've ever felt like you're reading ancient runes when looking at Git commands, fear not! This guide is your magical map to deciphering the cryptic incantations of Git.
What is Git?
Imagine you're a time traveler with a superpower to remember everything you've ever done. That's Git for your code! It's a Version Control System (VCS) that keeps a history of your digital creations, making sure you can always revisit your past work, see who changed what, and even collaborate with other time travelers without messing up the timeline.
The Git Glossary: A Treasure Trove of Terms
Repository (Repo)
This is your treasure chest 🏴☠️ where all your gold (code) is stored. A repository can live on your computer (local repository) or on the internet (remote repository), like a buried treasure on a remote island.
Clone
Arrr! To clone is to create an exact copy of a remote repository on your own machine. It's like finding a treasure map and making a copy so you can embark on your own adventure.
git clone https://github.com/user/repository.git
Commit
A commit is a snapshot of your treasure at a specific point in time. It's like taking a photo of your loot so you can remember where everything was.
git commit -m"Add a shiny new doubloon"
Branch
Think of branches as alternate realities. You can work on different features or experiments without affecting the main reality (the `master` or `main` branch).
git branch new-feature
Merge
When you're ready to combine one reality (branch) with another, you merge them. It's like bringing back the knowledge from an alternate universe to your own.
git merge new-feature
Pull
Pulling is like receiving the latest news from the remote island (repository). It updates your local repository with changes from the remote one.
git pull origin main
Push
After you've added more treasure to your chest (committed changes), you push it to the remote repository so others can see your newfound wealth.
git push origin main
Fork
Forking is when you create your own copy of someone else's repository. It's like claiming an uninhabited island as your own to start building from what's already there.
Pull Request (PR)
This is when you ask the captain of another ship (repository) to consider adding your treasure to theirs. It's a request to merge your changes into their repository.
Checkout
When you want to switch between realities (branches) or visit a specific point in time (commit), you checkout that branch or commit.
git checkout new-feature
Stash
Stash is like hiding your treasure under a rock. You temporarily store changes you're not ready to commit so you can work on something else.
git stash
Rebase
Rebasing is a way to move your work from one point in time to another. It's like rewriting history so that your adventures happened in a different order.
git rebase main
The Adventure Continues...
Congratulations! You've just been initiated into the ranks of Git adventurers. With these terms in your satchel, you're ready to embark on quests of coding and collaboration. Remember, the Git journey is filled with learning and discovery, so don't be afraid to explore and experiment.
May your repositories always be conflict-free, and your commits be ever meaningful. Happy coding, brave traveler! 🚀👨💻👩💻
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (