Skip to main content

Git Basics Part 1

Git Basics Cheatsheet

Git Basics Cheatsheet

This cheatsheet covers essential Git commands for version control. These commands are fundamental for managing code and collaborating with others.

Configuration

Command Description
git config --global user.name "Your Name" Sets your global username for Git commits.
git config --global user.email "your.email@example.com" Sets your global email address for Git commits.
git config --global core.editor "vim" Sets your default text editor for Git (e.g., vim, nano, code).

Initializing a Repository

Command Description
git init Initializes a new Git repository in the current directory.
git clone <repository_url> Clones a remote repository to your local machine.

Working with Changes

Command Description
git status Shows the status of your working directory and staging area.
git add <file> Adds a file to the staging area.
git add . Adds all changes in the current directory to the staging area.
git commit -m "Commit message" Commits the staged changes with a descriptive message.
git diff Shows the changes between your working directory and the staging area.
git diff --staged Shows the changes between the staging area and the last commit.

Branching and Merging

Command Description
git branch Lists all local branches.
git branch <branch_name> Creates a new branch.
git checkout <branch_name> Switches to the specified branch.
git merge <branch_name> Merges the specified branch into the current branch.
git branch -d <branch_name> Deletes a local branch.

Remote Repositories

Command Description
git remote add origin <repository_url> Adds a remote repository named "origin".
git push origin <branch_name> Pushes local commits to the remote repository.
git pull origin <branch_name> Pulls changes from the remote repository.

Undoing Changes

Command Description
git reset HEAD <file> Unstages a file from the staging area.
git checkout -- <file> Discards changes in the working directory for a specific file.
git revert <commit_hash> Creates a new commit that undoes the changes introduced by the specified commit.

This is a basic overview of Git commands. For more advanced usage and detailed explanations, refer to the official Git documentation.

Comments

Popular posts from this blog

Powershell Automation Basics - Part 1

Pentest Notes: PowerShell Automation - Basics Pentest Notes: PowerShell Automation - Basics These notes cover PowerShell automation for penetration testing, focusing on practical applications and techniques. What is PowerShell? A powerful scripting language and command-line shell built on the .NET framework, heavily integrated with Windows. Ideal for system administration and automation, making it a valuable tool for pentesters. Why PowerShell for Pentesting? Native to Windows: Pre-installed on most Windows systems. Object-oriented: Allows for complex data manipulation and interaction with APIs. Access to .NET Framework: Enables interaction with a vast library of classes and functions. Remoting capabilities: Execute commands on remote systems. Bypass security restrictions: Can be used to circumvent some security measures if not properly configured. Basic Syntax Cmdlets: Commands in PowerShell (e.g., Get-Process , Get-Service , Get-ChildItem ). P...

Pivoting Commands

Pivoting for Red Teamers Pivoting in Red Team Operations: A Complete Guide Introduction In a real-world red team operation , gaining initial access is just the beginning. The real challenge is pivoting —the ability to move laterally, escalate privileges, and compromise additional systems within the network. What is Pivoting? Pivoting is a technique used to route traffic through a compromised host to access internal networks that are not directly reachable. Types of Pivoting Network Pivoting : Routes network traffic through a compromised host (e.g., SSH Tunneling, Metasploit, ProxyChains). Port Forwarding : Exposes specific ports from an internal machine to the attacker (e.g., SSH Local Port Forwarding). Step 1: Pivoting Using Metasploit Setting Up a Pivot via Meterpreter meterpreter> backgroun...

SQLDB Pentest

Pivoting for Red Teamers SQL Database & SQL Injection Pentesting Cheat Sheet SQL databases store crucial application data, and misconfigurations can make them vulnerable to SQL Injection (SQLi) attacks. This guide covers database enumeration, privilege escalation, and SQL injection techniques. Step 1: Identifying SQL Database Type Check the database type by sending payloads in the input fields or URL: ' OR 1=1 -- (MySQL, PostgreSQL, MSSQL) ' UNION SELECT 1,2,3 -- (Check column count) ' AND 1=CONVERT(int,@@version) -- (MSSQL Test) Observe the error messages for database identification. Step 2: Enumerating Database Tables & Columns Use SQL queries to extract database structure. For MySQL: SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE(); SELECT column_name FROM information_schema.columns WHERE table_name='user...