Git & GitHub for Hackers β Version Control from Zero to Real-World Usage
If you are not using Git, you are working like a beginner.
Git is not optional.
It is how developers, hackers, and teams manage code.
π§ WHAT IS GIT?
Git is a version control system.
It tracks:
- Code changes
- File history
- Collaboration
It allows you to:
- Go back in time
- Work with teams
- Manage projects safely
π WHAT IS GITHUB?
Git = tool (local)
GitHub = platform (online)
GitHub stores your code remotely
and allows collaboration.
βοΈ INITIAL SETUP
Set your identity:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"Check config:
git config --listπ CREATE REPOSITORY
Initialize Git:
git initThis creates:
.git/This is where Git stores everything.
π BASIC WORKFLOW (VERY IMPORTANT)
Git has 3 stages:
- Working directory
- Staging area
- Repository
π§ WORKFLOW COMMANDS
Check status:
git statusAdd files:
git add file.txt
git add .Commit changes:
git commit -m "Initial commit"π§ WHAT IS A COMMIT?
A commit is a snapshot of your project.
π VIEW HISTORY
git logShort version:
git log --onelineπ CHANGES & DIFFERENCES
See changes:
git diffπ CONNECT TO GITHUB
Add remote:
git remote add origin https://github.com/username/repo.gitPush code:
git push -u origin mainβ¬οΈ CLONE REPOSITORY
Download project:
git clone https://github.com/user/repo.gitπ BRANCHING (VERY IMPORTANT)
Create branch:
git branch featureSwitch branch:
git checkout featureOr:
git checkout -b featureπ§ WHY BRANCHES?
Work without breaking main code.
π MERGING
Merge branch:
git checkout main
git merge featureβ οΈ MERGE CONFLICTS
Happens when:
Two changes affect same lines.
You must fix manually.
π PULL & UPDATE
Get latest changes:
git pull origin mainπ§ REAL CYBERSECURITY USE
Git is used for:
- Storing exploits
- Sharing tools
- Tracking changes in scripts
- Collaboration in teams
π₯ REAL EXAMPLES
Clone hacking tool:
git clone https://github.com/.../tool.gitUpdate tool:
git pullπ¨ COMMON MISTAKES
- Not committing regularly
- Pushing broken code
- Ignoring branches
- Not using .gitignore
π .GITIGNORE (VERY IMPORTANT)
Used to ignore files.
Example:
node_modules/
.env
logs/π Never upload secrets.
π SECURITY WARNING
Do NOT upload:
- API keys
- Passwords
- Tokens
Attackers scan GitHub for leaks.
β‘ PRO COMMANDS
Undo changes:
git checkout -- file.txtReset commit:
git reset --soft HEAD~1Force reset:
git reset --hard HEAD~1π§ MINDSET
Git is not just commands.
It is:
- Version control thinking
- Safe experimentation
- Collaboration mindset
π₯ FINAL MESSAGE
If you donβt use Git:
You will lose code.
You will lose progress.
You will struggle in teams.
If you master Git: You control your projects.