A comprehensive repository for learning and mastering Git and GitHub from a DevOps perspective. This repository contains Git fundamentals, branching strategies, collaboration workflows, and hands-on exercises commonly used in real-world DevOps environments.
Version control is one of the most essential skills for every DevOps Engineer. This repository documents my Git learning journey, practical exercises, and real-world Git workflows used in software development and DevOps projects.
Whether you're a beginner or an experienced engineer, this repository serves as a quick reference and practice guide for Git and GitHub.
After completing this repository, you will be able to:
- Understand Git architecture
- Initialize and manage Git repositories
- Track file changes
- Create meaningful commits
- Work with branches
- Merge branches successfully
- Resolve merge conflicts
- Use GitHub for collaboration
- Manage remote repositories
- Create Pull Requests
- Follow Git best practices in DevOps environments
- Git Installation
- Git Configuration
- Git Repository Initialization
- Git Status
- Git Add
- Git Commit
- Git Log
- Git Diff
- Git Branch
- Git Checkout
- Git Switch
- Git Merge
- Git Rebase
- Git Reset
- Git Restore
- Git Stash
- Git Tags
- Git Ignore (.gitignore)
- Git Remote
- Git Clone
- Git Fetch
- Git Pull
- Git Push
- GitHub Basics
- Pull Requests
- Forks
- Merge Conflicts
- Git Branching Strategy
- Git Workflow for DevOps
- Best Practices
git_for_devops/
│
├── 01-installation/
├── 02-git-basics/
├── 03-commits/
├── 04-branching/
├── 05-merging/
├── 06-rebasing/
├── 07-remote-repositories/
├── 08-github/
├── 09-gitignore/
├── 10-tags/
├── 11-stash/
├── 12-conflicts/
├── 13-projects/
├── 14-best-practices/
└── README.md
Before getting started, ensure you have:
- Basic Linux or Windows command-line knowledge
- Git installed
- A GitHub account
- Visual Studio Code (recommended)
Clone this repository:
git clone https://github.com/sammad00/git_for_devops.gitNavigate into the project:
cd git_for_devopsVerify Git installation:
git --versionInitialize a repository:
git initCheck repository status:
git statusAdd files:
git add .Commit changes:
git commit -m "Initial commit"View commit history:
git log --onelineCreate a new branch:
git branch featureSwitch to a branch:
git checkout featureOr using the modern command:
git switch featureMerge a branch:
git merge featurePull the latest changes:
git pull origin mainPush changes:
git push origin mainClone a repository:
git clone <repository-url>main
│
├── dev
│ │
│ ├── feature/login
│ ├── feature/docker
│ └── feature/api
│
└── hotfix
Typical workflow:
- Create a feature branch from
dev. - Make and commit your changes.
- Push the feature branch to GitHub.
- Open a Pull Request.
- Merge into
dev. - Test changes.
- Merge
devintomainfor production releases.
- Write clear and descriptive commit messages.
- Commit small, focused changes.
- Pull before pushing to avoid conflicts.
- Use feature branches for new work.
- Keep the
mainbranch stable. - Review Pull Requests before merging.
- Use
.gitignoreto exclude unnecessary files. - Avoid committing secrets, passwords, or API keys.
- Tag stable releases using Git tags.
Git plays a central role in DevOps by enabling:
- Source Code Management (SCM)
- CI/CD Pipelines
- Infrastructure as Code (IaC)
- Team Collaboration
- Automated Deployments
- Version Tracking
- Release Management
- Change Auditing
- Git Basics
- Branching
- Merging
- GitHub
- Pull Requests
- Conflict Resolution
- Git Rebase
- Git Tags
- GitHub Actions
- CI/CD with Jenkins
- Docker Integration
- Kubernetes Deployments
Contributions are welcome! If you'd like to improve this repository:
- Fork the repository.
- Create a new branch.
- Commit your changes.
- Push your branch.
- Open a Pull Request.
This project is licensed under the MIT License.
Abdul Sammad
- DevOps Engineer
- Linux System Administrator
- Docker & Kubernetes Enthusiast
- Passionate about Automation, Cloud Computing, and Open Source
If you found this repository useful, please consider giving it a ⭐ and sharing it with others.