# Important Git Commands

The Git version control system can be optimized best with the appropriate Git commands. We’ll show you the most important commands. Git commands are executed from the terminal.

## How do I configure a name and email with Git commands?

A username and valid email address are required to work on a project. Use the following Git commands to configure these.

Configure your username:

```none
git config --global user.name "example name"
```

Check your username:

```none
git config --global user.name
```

Enter your email address:

```none
git config --global user.email "exampleaddress@example.com"
```

This is how you access your email:

```none
git config --global user.email
```

This command will show all your entries in the overview:

```none
git config --global --list
```

## How do I check the overview and changes?

There are several important Git commands that make it easier for you to work on and in your repository. This command will give an overview of the repository:

```none
git close gitexample@example.com:Repository.get
```

This gives you an overview of the local status and the changes that have not been adjusted yet:

```none
git status
```

The changes are highlighted in red.

Use [Git Diff](https://www.ionos.ca/digitalguide/websites/web-development/git-diff/ "Git Diff") to check for differences between the pending commit and the last current version:

```none
git diff HEAD
```

## What are the Git Commands for repositories?

The following Git commands allow you to save changes to the local repository yourself.

Use this command to add all new, changed or deleted files:

```none
git add
```

However, if you only want to apply certain changes to your commit, put them in square brackets after the command:

```none
git add [ file_1 file_2 file_3 | file-pattern ]
```

Finalize a [Git commit](https://www.ionos.ca/digitalguide/websites/web-development/git-commit/ "Git Commit") using this command:

```none
git commit
```

Use this command to send explanations about the current step:

```none
git commit -m "Here’s your message"
```

Show the current commits in your local repository with [Git Log](https://www.ionos.ca/digitalguide/websites/web-development/git-log/ "Git Log"):

```none
git log
```

## What are the Git commands for branches

The following Git commands are required to work with a branch.

List all branches:

```none
git branch
```

Information about the different branches:

```none
git fetch
```

List of all branches in the local repository:

```none
git branch -a
```

Create a new branch:

```none
git branch new-branch-name
```

Switch to a specific branch with [Git Checkout](https://www.ionos.ca/digitalguide/websites/web-development/git-checkout/ "Git Checkout"):

```none
git checkout name-of-another-branch
```

Create a new branch and switch to it:

```none
git checkout -b new-branch
```

Move the new branch from the local repository to the commit repository:

```none
git push -i remote-name new-branch
```

Delete a branch in the local repository as long as it contains accepted changes only:

```none
git branch -d branch-name
```

Add changes from a branch to the current branch:

```none
git merge other-branch-name
```

Retrieve changes from a remote repository with [Git Pull](https://www.ionos.ca/digitalguide/websites/web-development/git-pull/ "Git Pull"):

```none
git pull other-branch
```

## What are the Git commands for tags?

These Git Commands will make your job easier if you use tags.

List all tags:

```none
git tag
```

Retrieve all tags from the commit repository for your local repository:

```none
git fetch --tags
```

Display a specific day:

```none
git show tag-name
```

Push a specific tag to the commit repository with [Git Push](https://www.ionos.ca/digitalguide/websites/web-development/git-push/ "Git Push"):

```none
git push remote-name tag-example
```

Push all tags to the commit repository:

```none
git push remote-name --tags
```

Delete tag in a local repository:

```none
git tag -d tag-example
```

## Using Git optimally

These Git commands will enable you to work quickly and effectively in the version control system. You’ll also find a [Git tutorial](https://www.ionos.ca/digitalguide/websites/web-development/git-tutorial/ "Git Tutorial") for getting started as well as a [Git cheat sheet with a PDF download](https://www.ionos.ca/digitalguide/websites/web-development/git-cheat-sheet/) in our Digital Guide. If you are looking for an alternative to Linus Torvalds system, our comparison of [Git vs. SVN](https://www.ionos.ca/digitalguide/websites/web-development/svn-vs-git-comparing-version-control-systems/ "SVN vs Git – comparing version control systems") might be of interest to you.

---

### Tip

Bring your project online in just three steps with [Deploy Now](https://www.ionos.ca/hosting/deploy-now "Deploy websites and apps directly using GitHub — IONOS") from IONOS. Static websites and single page apps can be made available to your customers even faster than before.

---


This is a markdown version of: [https://www.ionos.ca/digitalguide/websites/web-development/git-commands/](https://www.ionos.ca/digitalguide/websites/web-development/git-commands/) for AI/LLM consumption.