Eridian
eridian.xyzx.comGitHub
  • πŸ“–Eridian Docs
  • Ethereum Dev
    • ✏️Ethereum Notes
      • πŸŽ›οΈTechnical Basics
      • πŸͺ§Ethereum Addresses
      • πŸ“šEthereum State Explained
      • β›½Gas Fees Explained
    • πŸ”§Useful Tools
      • ☁️Ethers
      • *️⃣Ethernal
    • πŸ“Solidity Notes
      • ❔Interview Questions
        • 🟒1. Easy - Interview Questions
        • 🟠2. Medium - Interview Questions
        • 🟑3. Hard - Interview Questions
        • πŸ”΄4. Advanced - Interview Questions
      • πŸ’‘Note Ideas
      • ABI
      • abi.encodePacked
      • Abstract Contracts
      • Arrays
      • Casting
      • CEI - Checks, Effects, Interactions
      • Comments (NATSPEC)
      • Constructor
      • Contract Structure & Versions
      • Data - Storage vs Memory
      • Data - Storage Layout
      • Enum
      • Errors (require & revert)
      • Events
      • EVM Opcodes
      • External Contract Interaction
      • πŸ—οΈExternal Dependencies
      • Functions
      • Function Modifiers
      • If / Else / For / While Loops
      • Inheritance
      • Interfaces
      • Keccak256
      • Library
      • Mappings
      • msg.sender
      • Objects & Types
      • OpenZeppelin
      • Payable
      • Public State Variable vs Function
      • Receive & Fallback
      • Security
      • Self Destruct
      • Send ETH (transfer, send, call)
      • Stack Too Deep
      • Structs
      • Style Guide
      • Time Units
      • Try / Catch
      • Typecasting
      • Using Directive
      • Variables, Consts & Immutable
      • Withdraws
    • βš’οΈFoundry Notes
      • πŸ“–Docs & GitHub Pages
      • 🀝Useful Commands
        • πŸ”¨Anvil
        • πŸͺ„Cast
        • πŸ”₯Forge
      • πŸ§ͺTests
        • Cheatcodes
      • πŸ“Useful Scripts
        • Deploy Contract Using Hex
    • πŸ‘ΎDeFi Challenges
      • πŸ‘¨β€πŸš€Ethernaut
        • Ethernaut - Template
        • Level 1 - Fallback ⏺
        • Level 2 - Fallout ⏺
        • Level 3 - Coin Flip ⏺⏺
        • Level 4 - Telephone ⏺
        • Level 5 - Token ⏺⏺
        • Level 6 - Delegation ⏺⏺
        • Level 7 - Force ⏺⏺⏺
        • Level 8 - Vault ⏺⏺
        • Level 9 - King ⏺⏺⏺
        • Level 10 - Re-entrancy ⏺⏺⏺
        • Level 11 - Elevator ⏺⏺
        • Level 12 - Privacy ⏺⏺⏺
        • Level 13 - Gatekeeper 1 ⏺⏺⏺⏺
        • Level 14 - Gatekeeper 2 ⏺⏺⏺
        • Level 15 - Naught Coin ⏺⏺⏺
        • Level 16 - Preservation ⏺⏺⏺⏺
        • Level 17 - Recovery ⏺⏺⏺
        • Level 18 - Magic Number ⏺⏺⏺
        • Level 19 - Alien Codex ⏺⏺⏺⏺
        • Level 20 - Denial ⏺⏺⏺
        • Level 21 - Shop ⏺⏺
        • Level 22 - Dex ⏺⏺
        • Level 23 - Dex Two ⏺⏺
        • Level 24 - Puzzle Wallet ⏺⏺⏺⏺
        • Level 25 - Motorbike ⏺⏺⏺
        • Level 26 - DoubleEntryPoint ⏺⏺
        • Level 27 - Good Samaritan ⏺⏺⏺
        • Level 28 - Gatekeeper 3 ⏺⏺⏺
        • Level 29 - Switch ⏺⏺⏺⏺
        • Level 30 - Higher Order ⏺⏺⏺⏺
        • Level 31 - Stake ⏺⏺⏺
      • πŸ’ΈDamn Vulnerable DeFi
    • πŸ”Auditing
      • πŸ—žοΈExploit Resources
      • πŸ”§Audit Tools
    • πŸ€–MEV
  • Infrastructure Docs
    • πŸ’»Hardware
    • 🐧Linux
      • πŸ“–Linux Glossary
      • ⌨️Linux Commands
      • πŸ’ΎInstallation
      • πŸ—οΈMaintenance
      • πŸ–₯️Ubuntu Desktop
      • πŸ›œZeroTier
      • 🎞️TMUX
      • πŸ”΅Bluetooth
    • ⛓️Ethereum Clients
      • βš™οΈExecution Clients
        • ⛏️Geth
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • 🐻Erigon
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • 🧢Besu
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • 🀝Beacon Clients
        • πŸ’‘Lighthouse
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
        • πŸͺ…Teku
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • πŸ’ŽValidator Clients
        • πŸ’‘Lighthouse
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • βž•L2 Clients
        • πŸ”΅Base
          • πŸ’ΎInstallation
          • ⌨️Useful Commands
          • πŸ—οΈMaintenance
      • πŸ’°MEV Boost
        • πŸ’ΎInstallation
        • πŸ—οΈMaintenance
    • 🚨Alerting and Monitoring
      • πŸ”₯Prometheus
      • 🌑️HealthChecks.io
      • πŸ“ŸPagerDuty
  • General Dev
    • πŸ’ΎGit Notes
      • Repos
      • Committing changes
      • Branches
      • Merging & Rebasing
      • PRs
Powered by GitBook
On this page
Edit on GitHub
  1. General Dev
  2. Git Notes

Committing changes

Description
Commands

Stage files for commit

  • Use "git add” to add files to every commit, it’s not a blanket save

  • Use a wildcard * to add all files of the same extension to the staging area

  • Use . to stage all changes ready for commit

  • If you are in the root directory of your repository, git add . and git add -A will have the same effect, staging all changes in the repository. However, if you are in a subdirectory, git add . will only stage changes in that directory and its subdirectories, while git add -A will still stage changes from the entire repository.

git add <FILE_NAME>

git add *.html

git add .

git add -A

Show all changes currently staged for commit

git status

Unstage a file after adding it

git reset HEAD <FILE_NAME>

Commit changes

  • Comments should be in present tense (e.g. "Add comments and update styling")

  • -a stages all changes so you can stage changes and commit with a comment all in one line instead of the separate command git add . but only works on files that are already being tracked, so not that useful for newly added files...

  • --amend allows you to edit the commit e.g. change the comment

git commit -m "<COMMENT>"git commit -am "<COMMENT>"

Change details of the last commit

  • opens an editor by default or add -m to

git commit --amend

git commit --amend -m "<NEW_COMMIT_MESSAGE>"

Change a specific commit and all the following commits

  • ^ use this to get the parent of the commit you want to change

  • --root references the very first commit in a repo

git rebase --interactive <PARENT_OF_COMMIT>

git rebase -i <COMMIT_TO_EDIT>^

git rebase -i --root

Last updated 2 months ago

πŸ’Ύ