Skip to content

Welcome to the Git_and_Github repository! This repository is a comprehensive guide that covers essential Git commands, best practices, and how to effectively use GitHub for collaboration and version control.

Notifications You must be signed in to change notification settings

hcsarker/Git_and_GitHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Git and GitHub - The Ultimate Guide

Welcome to the Git_and_Github repository! This repository is a comprehensive guide that covers essential Git commands, best practices, and how to effectively use GitHub for collaboration and version control.

📌 Table of Contents

📖 Introduction

Git is a powerful distributed version control system that helps developers track changes in their code, collaborate effectively, and maintain a history of modifications. GitHub enhances Git by providing a cloud-based hosting service, enabling teamwork, issue tracking, and code sharing.

💡 Why Use Git and GitHub?

Version Control: Keep track of every change in your project. ✅ Collaboration: Work seamlessly with teams across the globe. ✅ Backup & Security: Securely store your code in remote repositories. ✅ Efficient Workflow: Branching, merging, and pull requests make development structured and organized.

🚀 Getting Started with Git

📌 Install Git

Kali Linux:

dpkg -l | grep git   # Check if Git is already installed
sudo apt update
sudo apt install git -y

Windows:

Download and install Git from git-scm.com.

📌 Verify Installation

git --version

📌 Configure Git

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

📌 Initialize a Repository

git init

📌 Clone an Existing Repository

git clone <repository_url>

🔥 Basic Git Commands

  • Check Git Status: git status
  • Add Files to Staging Area: git add <file_name> or git add .
  • Commit Changes: git commit -m "Commit message"
  • View Commit History: git log --oneline --graph
  • Push Changes to Remote Repository: git push origin main
  • Pull Changes from Remote Repository: git pull origin main

🌎 Working with GitHub

  1. Create a GitHub Repository: Sign in to GitHub and create a new repository.
  2. Connect Local Repository to GitHub:
    git remote add origin <repository_url>
    git branch -M main
    git push -u origin main
  3. Fork and Clone Repositories: Contribute to open-source projects by forking repositories and cloning them locally.
  4. Create Pull Requests: Propose changes to a repository by creating pull requests.
  5. Manage Issues: Use GitHub Issues to track bugs and improvements.

🌿 Branching and Merging

  • Create a New Branch: git branch <branch_name>
  • Switch to a Branch: git checkout <branch_name> or git switch <branch_name>
  • Merge Branches:
    git checkout main
    git merge <branch_name>
  • Delete a Branch: git branch -d <branch_name>

⚡ Advanced Git Features

  • Stash Changes Temporarily: git stash
  • View Stash List: git stash list
  • Apply Stashed Changes: git stash apply
  • Revert a Commit: git revert <commit_hash>
  • Reset to a Previous Commit:
    git reset --hard <commit_hash>
  • Rebase Branches: git rebase <branch_name>

🤝 Contributing

Contributions are welcome! If you want to improve this repository, follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or fix.
  3. Make your changes and commit them.
  4. Push your changes to your forked repository.
  5. Create a pull request to merge your changes.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🚀 Happy Coding with Git & GitHub! 🎉

About

Welcome to the Git_and_Github repository! This repository is a comprehensive guide that covers essential Git commands, best practices, and how to effectively use GitHub for collaboration and version control.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published