DEV Community

Cover image for Basic Git Cheat Sheet
David Snyder
David Snyder

Posted on

1 1

Basic Git Cheat Sheet

Need to Know git commands

  1. git init (Initialize git repository)
  2. git checkout {branchname} - change the working branch
  3. git checkout -b {branchname} - create a branch and change the working branch into it
  4. git status - check for untrack and tracked files
  5. git add . - track changes in all files in the working branch
  6. git add {filename} - track changes in one file
  7. git commit -m “message” - save changes to local repository
  8. git remote add origin {remote url} - connecting to a remote repository
  9. git push origin {branchname} - push code from local to remote
  10. git push -u origin {branchname} - push code from local to remote on a branch that doesn't already exist on remote
  11. git merge {branchname} - merge changes from {branchname} into the current working branch

Note: Please remember not to work on master branch directly, always create different branches for different purposes.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay