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

MSRPC (Microsoft Remote Procedure Call) Pentesting - Port 135

  It is also known as a function call or a subroutine call. Default ports are 135, 593. Enumeration nmap --script msrpc-enum -p 135 <target-ip> RPC Endpoints To enumerate RPC endpoints, use impacket-rpcdump. impacket-rpcdump -port 135 <target-ip> | grep -E 'MS-EFSRPC|MS-RPRN|MS-PAR' MS-EFSRPC: It might be vulnerable to PetitPotam. MS-RPRN, MS-PAR: It might be vulnerable to PrintNightmare. Metasploit msfconsole msf> use auxiliary/scanner/dcerpc/endpoint_mapper msf> use auxiliary/scanner/dcerpc/hidden msf> use auxiliary/scanner/dcerpc/management msf> use auxiliary/scanner/dcerpc/tcp_dcerpc_auditor Connect # Anonymous logon rpcclient -N -U "" <target-ip> rpcclient -N -U "" -p 593 <target-ip> rpcclient -N -U "" dc.example.local # Specify username # -W: Workgroup # -N: No password rpcclient -U username <target-ip> rpcclient -W WORKGROUP -U username <target-ip> rpcclient -U username -N <target-ip...

Thread Modelling Cheatsheet: Know Your Weaknesses Before Attackers Do!

Threat Modelling Part - 1 What is Threat Modelling?      Threat modelling is the process of identifying, assessing, and mitigating potential security threats before they happen. It helps teams anticipate how systems can be attacked and build defences proactively , not reactively. Key Concepts Threat: Something (like a hacker or malware) that could exploit a weakness. Vulnerability: A flaw in your system that can be exploited. Risk: The chance that a threat will exploit a vulnerability to cause damage. Analogy : Threat = Burglar Vulnerability = Unlocked door Risk = Getting robbed because the door is open in a bad neighborhood  Threat Modelling Process (High-Level) Define the Scope – What systems/apps are you evaluating? Identify Assets – What needs protection? (e.g. data, services) Identify Threats – Think like an attacker. What could go wrong? Analyze Vulnerabilities – What weaknesses exist? Prioritize Ri...

DNS Pentest - Port 53

Recon Banner Grabbing - Identify DNS Server Versions # Use dig to determine DNS server versions dig version.bind CHAOS TXT @DNS # Alternatively, use nmap script to grab the banner nmap --script dns-nsid <DNS_IP> # Alternatively, use telnet to grab the banner nc -nv -u <DNS_IP> 53 DNS Server Discovery # Using dig dig NS <target-domain> # Using nslookup nslookup -type=NS <target-domain> Enumeration Using DNS enum dnsenum --dnsserver <DNS_IP> --enum -p 0 -s 0 -o subdomains.txt -f <WORDLIST> <DOMAIN> Using dig # Query DNS records dig hackviser.com # Query specific type of DNS records (e.g., A record) dig A hackviser.com # Perform a reverse DNS lookup dig -x <IP_ADDRESS> # Query a specific DNS server dig @<DNS_SERVER_IP> hackviser.com Using nslookup # Perform DNS queries nslookup hackviser.com # Query a specific type of DNS record (e.g., MX record) nslookup -type=MX hackviser.com # Query a specific DNS server nslookup ha...