---
layout: page
category-page: intermediate
category-title: Intermediate commands
tags: versioning commit merge software source code
author: Andrea Brites Marto
title: git
---
If you want to use Git on the shell you need to know how this command works (usually it is preinstalled on Mac and Linux).
The git command providesa set of high-level operations and full access to internals.
Here is the basic syntax but sometimes you will may have some more complicated:
git [flags] [path]
First of all, you need to know if you have the right version of git with:
git --version
Now that we know that we have the right version, we can move to the common git
flags used.
I will divide commands in different type of operation.
Start a working area
- clone: is used to clone a repository in a new directory.
- init: this onw is used to create an empty Git repository or reinitialize an existing one.
Work on the current changes
- add: add a file contents to the index.
- mv: move or renamea file, directory or a symlink (a symbolic link).
- rm: remove files from the working tree and from the index.
- format-patch id(commit): create a file patch
- am: apply a patch file
History and state
- log: show commit logs.
- status: show the working tree status.
Managing modification
- commit: record changes to the repository.
- diff: show changes between commits.
- merge: merge two or more development histories together.
- pull: fetch from and update your local directory with the repository.
- push: update the remote repository with your changes.