DEV Community

Tiago Teixeira
Tiago Teixeira

Posted on

10 Git Commands Every Developer Should Know

Mastering these core commands can significantly enhance your workflow:

  1. git init

    Initializes a new Git repository in your project directory. Start tracking your code effortlessly.

  2. git clone <repository-url>

    Copies an existing repository to your local machine. Perfect for working on shared projects.

  3. git status

    Displays the state of your working directory and staging area, helping you track changes.

  4. git add <file>

    Stages changes to be committed. Use git add . to stage all changes in the directory.

  5. git commit -m "message"

    Records changes to the repository with a descriptive message. This is your version snapshot.

  6. git branch

    Lists all branches in your repository. Add -a to include remote branches.

  7. git checkout <branch-name>

    Switches to a different branch. Use -b to create and switch to a new branch simultaneously.

  8. git merge <branch-name>

    Integrates changes from another branch into the current one. Resolve conflicts as needed.

  9. git pull

    Fetches updates from a remote repository and merges them into your current branch.

  10. git push

    Sends your local changes to the remote repository. Keep your work synced with your team.

👋 While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

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

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay