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...

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...

DAMN BASH

Bash Scripting: From Basic to Advanced Bash Scripting: From Basic to Advanced Bash (Bourne Again SHell) is a powerful command-line interpreter and scripting language commonly used in Linux and macOS environments. This post covers Bash scripting from basic commands to more advanced techniques. I. Basic Commands These commands are the building blocks of Bash scripting: Command Description ls Lists files and directories. cd Changes the current directory. pwd Prints the current working directory. mkdir Creates a new directory. rm Removes files or directories (use with caution!). cp Copies files or directories. mv Moves or renames files or directories. cat Displays file content. echo Prints text to the console. II. Variables Variables store data that can be used in your scripts: name="John Doe" echo "Hello, $name!" age=30 echo $((age + 5)) # Arithmetic operations III. Input/Output Redirection Redirect input an...