Post

Git Cheatsheet

Git Cheatsheet

This is a cheatsheet of the most commonly used Git commands.

  1. Configuring Git:
    1
    2
    
    git config --global user.name "Example"
    git config --global user.email example@example.com
    
  2. Initializing a repo and adding remote origin.
    1
    2
    3
    
    git init - innitializes empty git repo in current directory
    git remote add origin git@github.com:ArcticTechnology/sandbox.git
    git branch -M main
    
  3. Check the status of untracked files.
    1
    
    git status
    
  4. Adding files to repo and committing changes.
    1
    2
    
    git add .
    git commit -m "My Commit Message"
    
  5. Push files to Github.
    1
    
    git push
    
  6. Pulling files from Github
    1
    
    git pull
    
  7. Forking projects from Github
    1
    
    git clone
    
  8. Fixing up a commit, for combining multiple commits into one.
    1
    
    git rebase -i
    
  9. Resetting a commit, if you want to redo a commit that you havent pushed yet.
    1
    
    git reset @~
    
This post is licensed under CC BY 4.0 by the author.