tweaks

accent
recent notes

Git commands you use every day

Git is a distributed, free, and open version control system. It helps multiple people work on the same project at the same time and makes the development flow more predictable. This text is a map of the commands that appear most in everyday life — with the details that often confuse those who are starting out.

Why it pays to master this early

When you learn the few right commands, the rest becomes a reflection: you stop being afraid of “spoiling” the history and gain confidence to experiment in branches. The official documentation remains the reference: git-scm.com/docs.

Installation and where to rotate

Download Git from git-scm.com.

After installing, you can use Git Bash, the system terminal or the integrated VS Code terminal — the behavior of the commands is the same.

Initial Setup

Create an account on some platform (for example GitHub) and set up name and email once on the machine. Git uses this on every commit.

git config --global user.name "Your Name"
git config --global user.email "seu@email.com"

To check it out:

git config --global user.name
git config --global user.email

Create or clone a project

New repository in current folder:

git init

Download a repository that already exists (use the HTTPS or SSH URL that the platform shows — for example https://github.com/usuario/projeto.git):

git clone https://github.com/usuario/projeto.git

If the remote addressoriginhas changed (or was misspelled at the time of the clone):

git remote set-url origin https://github.com/usuario/projeto.git

Branches: working without mixing everything

Good practice: Before changing code “on main”, create a branch.

git branch branch-name
git checkout name-of-the-branch

Or create and already enter the branch in one step:

git checkout -b branch-name

In modern Git, the equivalent is:

git switch -c branch-name

To see which branch you're in:

git branch

See what's changed

git status
git diff

status lists changed files; diff shows the content of the changes.

Prepare and record changes

“Staged” means that the file is marked to enter the next commit. You add files to the stage with git add (there is no main command named git stage).

A file:

git add path/do/file

Everything that has changed in the current folder and below:

git add .

Take the snapshot:

git commit -m "Clear message of what has changed"

Update from remote

Before sending changes, it is common to pull what others have already climbed in the same branch:

git pull origin name-of-the-branch

In many streams, git pull alone (with the branch already tracked) also works.

Send to Remote

When the commits are ready on your machine, send to the server:

git push origin branch-name

Closing

There are many names at first, but the flow is always the same: branch → edit → status/diff → add → commit → pull (when necessary) → push. With repetition, this is no longer a “command list” and becomes part of the job. If something goes wrong, documentation and git status often point to the next step.

Thank you for reading.