Skip to Content
๐Ÿ“ Basics๐ŸŒฟ Git

๐ŸŒฟ Git

Gitย  is the standard tool for tracking code changes and collaborating. It is essential for anyone working on smart contracts, blockchain tooling, or decentralized applications. Its structure resembles a lightweight local โ€œledgerโ€ that records every update to your project.

๐Ÿงฑ Why does it matter in Web3

  • Keeps a transparent history of all code changes
  • Branching allows safe experimentation (similar to testnets)
  • Pull requests enable review before merging (like proposing protocol upgrades)
  • Crucial when multiple contributors work on the same smart-contract or dApp repository

๐Ÿš€ Core Commands

git clone <repo> # Download the project git status # View changes git add . # Stage edits git commit -m "" # Create a new commit ('block' in your history) git pull # Sync with remote updates git push # Publish your changes

๐ŸŒฟ Typical Web3 Workflow

  • Clone a smart contract template or protocol repository: Solana Starter Kitย , dapp-scaffold (Solana)ย , Scaffold-ETH (Ethereum)ย , template-ethereum-contractsย 

  • Create a feature branch to test new logic or contract upgrades
    Keeps your experiments isolated from the main codebase; you can safely test without breaking the main protocol.
    Example commands:

    # Create and switch to a new branch git checkout -b feature/my-new-contract # Check branch status git status
  • Submit a pull request for review
    Similar to proposing an on-chain improvement. Your code can be audited and discussed by peers before merging:

    # Push your feature branch to remote git push origin feature/my-new-contract # Open a pull request on GitHub/GitLab # (usually via the repository web interface)
  • Merge only after audits or peer review
    Ensures that all changes are verified, reducing the risk of bugs or vulnerabilities in your deployed contracts.

    # Switch to main branch git checkout main # Merge the feature branch after approval git merge feature/my-new-contract # Push merged changes to remote git push origin main

๐Ÿ›ก Good Practices

  • Write clear commit messages
  • Pull regularly to avoid conflicts
  • Avoid pushing directly to main
  • Review code with the same care as auditing a smart contract
Last updated on