Sec-88
  • 🧑Whoami
  • 🕸️Web-AppSec
    • Features Abuse
      • 2FA
      • Ban Feature
      • CAPTCHA
      • Commenting
      • Contact us
      • File-Upload
      • Inviting Feature
      • Messaging Features
      • Money-Related Features
      • Newsletter
      • Profile - Settings
      • Registration
      • Reset Password
      • Review
      • Rich Editor/Text
      • Social Sharing
      • Billing-Shipping Address Management
      • Integrations - Webhooks
      • API Key Management
    • Reconnaissance
      • Attacking Organizations with big scopes
    • Subdomain Enumeration
    • Fingerprinting
    • Dorking
    • XSS-HTML Injection
    • Improper Authentication
      • JWT Security
    • OAUTH Misconfigurations
      • OAuth 2.0 Basics
      • OAUTH Misconfigurations
    • Auth0 Misconfigurations
    • Broken Access Control
      • Insecure Direct Object References (IDOR)
      • 403 Bypass
    • Broken Link Injection
    • Command Injection
    • CORS
    • CRLF
    • CSRF
    • Host Header Attacks
    • HTTP request smuggling
    • JSON Request Testing
    • LFI
      • LFI to RCE
    • No Rate Limit
    • Parameters Manual Testing
    • Open Redirect
    • Registration & Takeover Bugs
    • Remote Code Execution (RCE)
    • Session Fixation
    • SQL Injection
      • SQL To RCE
    • SSRF
    • SSTI
    • Subdomain Takeover
    • Web Caching Vulnerabilities
    • WebSockets
    • XXE
      • XXE to RCE
    • Cookie Based Attacks
    • CMS
      • AEM [Adobe CMS]
    • XSSI (Cross Site Script Inclusion)
    • NoSQL injection
    • Local VS Remote Session Fixation
    • Protection
      • Security Mechanisms for Websites
      • Cookie Flags
      • SameSite Cookie Restrictions
      • Same-origin policy (SOP)
      • CSP
    • Hacking IIS Applications
    • Dependency Confusion
    • Attacking Secondary Context
    • Hacking Web Sockets
    • IDN Homograph Attack
    • DNS Rebinding Attack
    • LLM Hacking Checklist
    • Bypass URL Filtration
    • Cross-Site Path Traversal (CSPT)
    • PostMessage Security
    • Prototype Pollution
      • Client-Side Prototype Pollution
      • Server-Side prototype pollution
    • Tools-Extensions-Bookmarks
    • WAF Bypassing Techniques
    • SSL/TLS Certificate Lifecycle
    • Serialization in .NET
    • Client-Side Attacks
      • JavaScript Analysis
    • Bug Bounty Platforms/Programs
  • ✉️API-Sec
    • GraphQL API Security Testing
      • The Basics
      • GraphQL Communication
      • Setting Up a Vulnerable GraphQL Server
      • GraphQL Hacking Tools
      • GraphQL Attack Surface
      • RECONNAISSANCE
      • GraphQL DOS
      • Information Disclosure
      • AUTHENTICATION AND AUTHORIZATION BYPASSES
      • Injection Vulnerabilities in GraphQL
      • REQUEST FORGERY AND HIJACKING
      • VULNERABILITIES, REPORTS AND EXPLOITS
      • GraphQL Hacking Checklist
    • API Recon
    • API Token Attacks
    • Broken Object Level Authorization (BOLA)
    • Broken Authentication
    • Evasive Maneuvers
    • Improper Assets Management
    • Mass Assignment Attacks
    • SSRF
    • Injection Vulnerabilities
    • Excessive Data Exposure
    • OWASP API TOP 10 MindMap
    • Scanning APIs with OWASP ZAP
  • 📱Android-AppSec
    • Setup Android App Pentesting environment on Arch
    • Setup Android App Pentesting environment on Mac M4
    • Setup Android Pentesting Environment on Debian Linux
    • Android App Fundamentals
      • Android Architecture
      • Android Security Model
      • Android App Components
        • Intents
        • Pending Intents
    • Android App Components Security Cheatsheet
    • Android App Pentesting Checklist
    • How To Get APK file for application
    • ADB Commands
    • APK structure
    • Android Permissions
    • Exported Activity Hacking
    • BroadcastReceiver Hacking
    • Content Provider Hacking
    • Signing the APK
    • Reverse Engineering APK
    • Deep Links Hacking
    • Drozer Cheat Sheet
    • SMALI
      • SMALI Cheat Sheet
      • Smali Code Patching Guide
    • Intent Redirection Vulnerability
    • Janus Vulnerability (CVE-2017-13156)
    • Task Hijacking
    • Hacking Labs
      • Injured Android
      • Hacking the VulnWebView Lab
      • Hacking InsecureBankv2 App
    • Frida Cheat Sheet
  • 📶Network-Sec
    • Networking Fundamentals
    • Open Ports Security Testing
    • Vulnerability Scanning
    • Client Side Attacks
    • Port Redirection and Tunneling
    • Password Attacks
    • Privilege Escalation [PrevEsc]
      • Linux Privilege Escalation
    • Buffer Overflow (BOF)
      • VulnServer
      • Sync Breez Enterprize
      • Crashed CTF
      • BOF for Linux
    • AV Evasion
    • Post Exploitation
      • File Transfer
      • Maintaining Access
      • Pivoting
      • Clean Up
    • Active Directory
      • Basic AD Pentesting
  • 💻Desktop AppSec
    • Thin Client vs. Thick Client
  • ☁️Cloud Sec
    • Salesforce Hacking
      • Basics
      • Salesforce SAAS Apps Hacking
    • Firebase
    • S3 Buckets Misconfigurations
  • 👨‍💻Programming
    • HTML
    • JavaScript (JS)
      • window.location object
    • Python
      • Python Tips
      • Set
        • SetMethods
    • JAVA
      • Java Essentials
      • Java Essentials Code Notes
      • Java OOP1
      • JAVA OOP Principles
        • Inheritance
        • Method Overriding
        • Abstract Class
        • Interface
        • polymorphism
        • Encapsulation
        • Composition
      • Java OOP Challenges
      • Exception Handling
    • Go
      • Go Syntax Tutorial in one file
      • Methods and Interfaces
      • Go Slices
      • Go Maps
      • Go Functions
      • Concurrency
      • Read Files
      • Write Files
      • Package
        • How to make personal Package
        • regexp Packages
        • Json
        • bufio
        • Time
      • Signals-Exit
      • Unit Testing
  • 🖥️Operating Systems
    • Linux
      • Linux Commands
      • Tools
      • Linux File System
      • Bash Scripting guide
      • tmux
      • Git
      • Install Go tools from private repositories using GitHub PAT
    • VPS
    • Burp Suite
  • ✍️Write-Ups
    • Hunting Methodology
    • API BAC leads to PII Data Disclosure
    • Misconfigured OATUH leads to Pre-Account Takeover
    • Automating Bug Bounty with GitHub Actions
    • From Recon to Reward: My Bug Bounty Methodology when Hunting on Public Bug Bounty Programs
    • Exploring Subdomains: From Enumeration to Takeover Victory
    • 0-Click Account Takeover via Insecure Password Reset Feature
    • How a Simple Click Can Lead to Account Takeover: An OAuth Insecure Implementation Vulnerability
    • The Power Of IDOR even if it is unpredictable IDs
    • Unlocking the Weak Spot: Exploiting Insecure Password Reset Tokens
    • AI Under Siege: Discovering and Exploiting Vulnerabilities
    • Inside the Classroom: How We Hacked Our Way Past Authorization on a Leading EdTech Platform
    • How We Secured Our Client’s Platform Against Interaction-Free Account Thefts
    • Unchecked Privileges: The Hidden Risk of Role Escalation in Collaborative Platforms
    • Decoding Server Behavior: The Key to Mass Account Takeover
    • Exploiting JSON-Based CSRF: The Hidden Threat in Profile Management
    • How We Turned a Medium XSS into a High Bounty by Bypassing HttpOnly Cookie
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Operating Systems
  2. Linux

Git

# Git Commands

# Setting up git
http://git-scm.com/download/mac  #to download and install Git
git config --global user.name "User Name"
git config --global user.email "email"


# Basic Commands
git init                        # Initializing a repository in an existing directory
git add .                       # Adding all files changes in a directory
git add filename                # Add Specific file
git add -A                      # Adding all files
git add -p                      # Choosing what changes to add 
git commit -am "update"         # Commit staged files
git commit filename -m 'commit message'    # Add file and commit
git commit -am 'insert commit message'     # Add file and commit staged file
git push -u origin branchname              # Pushing local branch to remote
git push origin master --force             # Force Pushing
git status                      # git status or branch
git checkout -b branchname      # Creating a local branch
git checkout -                  # Switching between 2 branches
git branch -d branchname        # Deleting a local branch  (this won't let you dete a branch that hasn't been merged yet)
git branch -rd origin/branchname # Deleting a remote branch
git push origin --delete branchname
git branch -D branchname        # this WILL delete a branch even if it hasn't been merged yet!
git remote prune origin         # Remove any remote refs you have locally that have been removed from your remote 
git branch -a                   # Viewing all branches, including local and remote branches
git branch -a --merged          # Viewing all branches that have been merged into your current branch, including local and remote
git branch -a --no-merged       # Viewing all branches that haven't been merged
git branch                      # Viewing local branches
git branch -r                   # Viewing remote branches
git push origin +branchname     # Pushing local branch after rebasing master into local branch- git fetch origin                # This will fetch all the remote branches for you.
git pull origin master          # Updating a local repository with changes from a Github repository
git branch --set-upstream-to=origin/foo foo # Tracking existing branch


#### Merging branch to trunk/master
git checkout trunk/master       # First checkout trunk/master
git merge branchname            # Now merge branch to trunk/master
git merge --abort               # To cancel a merge

#### Resetting
git reset --mixed [sha]                   # Mixes your head with a give sha - This lets you do things like split a commit
git reset HEAD origin/master -- filename  # Upstream master
git reset HEAD -- filename                # The version from the most recent commit
git reset HEAD^ -- filename               # git reset HEAD^ -- filename
git reset --hard sha                      # Move head to specific commit
Reset the staging area and the working directory to match the most recent commit. In addition to unstaging changes, the --hard flag tells Git to overwrite all changes in the working directory, too.
git reset --hard

#### Git remote
git remote show origin                                      # Show where 'origin' is pointing to and also tracked branches
git remote -v                                               # Show where 'origin' is pointing to
git remote set-url origin https://github.com/user/repo.git  # Change the 'origin' remote's URL
git remote add [NAME] https://github.com/user/fork-repo.git # Add a new 'origin' (Usually use to 'rebase' from forks)

#### Git grep
git grep 'something'                      # 'Searches' for parts of strings in a directory
git grep -n 'something'                   # 'Searches' for parts of strings in a directory and the -n prints out the line numbers where git has found matches
git grep -C<number of lines> 'something'  # 'Searches' for parts of string in a context (some lines before and some after the grepped term)
git grep -B<number of lines> 'something'  # 'Searches' for parts of string and also shows lines BEFORE the grepped term
git grep -A<number of lines> 'something'  # 'Searches' for parts of string and also shows lines AFTER the grepped term

#### Git log
git log                                   # Show a list of all commits in a repository. This command shows everything about a commit, such as commit ID, author, date and commit message.
git log -p                                # List of commits showing commit messages and changes
git log -S 'something'                    # List of commits with the particular expression you are looking for
git log --author 'Author Name'            # List of commits by author
git log --oneline                         # Show a list of commits in a repository in a more summarised way. This shows a shorter version of the commit ID and the commit message.
git log --since=yesterday                 # Show a list of commits in a repository since yesterday
git log --grep "term" --author "name"     # Shows log by author and searching for specific term inside the commit message

#### Checking what you are committing
git diff                                  # See all (non-staged) changes done to a local repo
git diff --cached                         # See all (staged) changes done to a local repo
git diff --stat origin/master             # Check what the changes between the files you've committed and the live repo

#### Useful commands
git tag --contains [sha]                  # Check if a sha is in production
git shortlog -s --author 'Author Name'    # Number of commits by author
git shortlog -s -n                        # List of authors and commits to a repository sorted alphabetically
git shortlog -n --author 'Author Name'    # List of commit comments by author (This also shows the total number of commits by the author)
git shortlog -s -n                        # Number of commits by contributors
git checkout -- filename                  # Undo local changes to a File
git cat-file sha -p                       # Shows more detailed info about a commit

# Show number of lines added and removed from a repository by an author since some time in the past.
git log --author="Author name" --pretty=tformat: --numstat --since=month | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'

# Shows the log in a more consisted way with the graph for branching and merging
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit


### Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push -u origin my-new-feature`
5. Submit a pull request - cheers!

### Handle Proxy
git config --global  http.proxy http://proxy_address:proxy_port    # Set   http  proxy
git config --global  https.proxy http://proxy_address:proxy_port   # set   https proxy
git config --global --unset http.proxy                             # unset http  proxy
git config --global --unset https.proxy                            # unset https proxy

# JEKYLL Deployment
git remote add origin <repository_url>
bundle exec jekyll s                                # starts a local development server that serves your Jekyll site  
JEKYLL_ENV=production bundle exec jekyll b          # This command builds your Jekyll site for production.     
git add .
git commit -m "Initial commit"
git push -u origin master
PrevioustmuxNextInstall Go tools from private repositories using GitHub PAT

Last updated 10 months ago

Was this helpful?

🖥️