If you’re new to programming or just getting serious about version control, Git might sound a bit intimidating. But don’t worry—by the end of this post, you'll understand what Git is, why it's useful, and how to get started with it.
📦 What Is Git?
Git is a version control system-— it tracks changes in your code (or any set of files), so you can go back in time, collaborate with others, and avoid messy mistakes.
Think of it like a magical undo button + time machine + teamwork assistant.
🚀 Installing Git
First, check if Git is installed. On most common Linux operating systems, it is pre-installed. Run git --version
to check. If it is not installed, or gives you a command not found error, head over to http://git-scm.com/ and download it. Restart your terminal.. and boom. Git should be installed. Let's get to using it.
🧰 Git Workflow
Here’s how Git usually works:
- Initialize a repository
- Make changes
- Stage the changes
- Commit them
Let’s walk through it.
## Make your first Git project.
First, open your selected project and run
git init
. This should create a hidden .git folder.
Next, select the files you would like to commit using git add <file name>
, or, to add all files, fun git add .
!
Once you've added your files, run git remote add origin https://github.com/your-username/your-repo.git
(Replace accordingly) and sign in with your Git[hub/lab] account.
Finally, once you have your files added and repository marked, run git commit -m "[your changelog message]
!
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.