GitOps Mastery: Your DevOps GitHub Cheat Sheet in 2024.
Level Up Your DevOps Workflow: Git Tricks Every Developer Needs.
1. ๐๐๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐๐๐ฌ๐ข๐๐ฌ:
- Clone a Repository:
Command:
git clone <repository_url>
- Initialize a Repository:
Command:
git init
2. ๐๐จ๐ซ๐ค๐ข๐ง๐ ๐ฐ๐ข๐ญ๐ก ๐๐ซ๐๐ง๐๐ก๐๐ฌ:
- Create a New Branch:
Command:
git branch <branch_name>
- Switch to a Branch:
Command:
git checkout <branch_name>
- Create and Switch to a New Branch:
Command:
git checkout -b <new_branch_name>
- List Branches:
Command:
git branch
3. ๐๐จ๐ฆ๐ฆ๐ข๐ญ๐ญ๐ข๐ง๐ ๐๐ก๐๐ง๐ ๐๐ฌ:
- Stage Changes:
Command:
git add <file_name>
- Stage All Changes:
Command:
git add .
- Commit Changes:
Command:
git commit -m โCommit messageโ
4. ๐๐ฎ๐ฅ๐ฅ๐ข๐ง๐ ๐๐ง๐ ๐๐ฎ๐ฌ๐ก๐ข๐ง๐ :
- Pull Changes from Remote:
Command:
git pull origin <branch_name>
- Push Changes to Remote:
Command:
git push origin <branch_name>
5. ๐๐๐ซ๐ ๐ข๐ง๐ ๐๐ก๐๐ง๐ ๐๐ฌ:
- Merge Branch into Current Branch:
Command:
git merge <branch_name>
6. ๐๐จ๐ซ๐ค๐ข๐ง๐ ๐ฐ๐ข๐ญ๐ก ๐๐๐ฆ๐จ๐ญ๐๐ฌ:
- Add a Remote Repository:
Command:
git remote add <remote_name> <repository_url>
- List Remote Repositories:
Command:
git remote -v
7. ๐๐๐ง๐๐ฅ๐ข๐ง๐ ๐๐จ๐ง๐๐ฅ๐ข๐๐ญ๐ฌ:
- Check for Conflicts:
Command:
git diff
- Resolve Conflicts and Continue Merge:
Command:
git add <file_name>
git merge โ continue
8. ๐๐ข๐ญ๐๐ฎ๐ ๐๐๐ญ๐ข๐จ๐ง๐ฌ:
- Workflow Syntax Checking:
Command:
git pull origin <branch_name>
git push origin <branch_name>
9. ๐๐ข๐ฌ๐๐๐ฅ๐ฅ๐๐ง๐๐จ๐ฎ๐ฌ:
- Check Git Status:
Command:
git status
- View Commit History:
Command:
git log
- Ignore Files (Add to `.gitignore`):
Command:
echo โ<file_name>โ >> .gitignore