GIT Tutorial



Introduction to git


Introduction to Git

Git is a free, open-source version control system designed to handle everything from small to very large projects with speed and efficiency. It tracks changes in source code, allowing multiple developers to collaborate efficiently.

πŸ’‘ Why Git?
  • Tracks every change made to files over time.
  • Allows collaboration between developers.
  • Reverts to previous versions easily.
  • Backs up your code safely.

πŸ“Œ What is Version Control?

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. Git is the most popular system used today.

πŸš€ Basic Git Workflow

Here’s the basic flow you’ll use often when working with Git:

  1. git init – Initialize a new repository
  2. git add – Add files to staging
  3. git commit – Commit changes with a message
  4. git push – Push changes to a remote repository (like GitHub)

πŸ“¦ Common Git Commands

  git init # Create a new Git repository git status # Check status of files git add filename # Stage a specific file git add . # Stage all changes git commit -m "msg" # Commit with message git log # View commit history git push origin main # Push code to remote repository  

πŸ§ͺ Example

Let's say you made changes to a file called index.html:
  • git add index.html
  • git commit -m "Updated index page"
  • git push origin main
These commands will save your changes and upload them to your remote repository.

🌐 Working with GitHub

GitHub is a cloud platform for hosting your Git repositories. After creating a repository on GitHub, you can connect it to your local repo using:

  git remote add origin https://github.com/username/repo-name.git git push -u origin main  
βœ… Tip: You must set up SSH or use HTTPS authentication to push code to GitHub.

🧠 Summary

  • Git is a tool to track code changes and collaborate with others.
  • GitHub is an online platform to host your repositories.
  • Commands like init, add, commit, and push are your best friends.

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review