GitOps Mastery: Your DevOps GitHub Cheat Sheet in 2024.

Arafat Ashrafi Talha
2 min readJan 31, 2024

--

Level Up Your DevOps Workflow: Git Tricks Every Developer Needs.

Collected.

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

Collected.

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>

Collected.

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

Collected.

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

--

--

Arafat Ashrafi Talha
Arafat Ashrafi Talha

Written by Arafat Ashrafi Talha

M.Sc. in Advanced Networking & Cyber Security | CEHv12 | Cybersecurity Enthusiast | Connect on LinkedIn: linkedin.com/in/arafat-ashrafi-talha

No responses yet