git - distributed version control system.

·

1 min read

git - cheat sheet

Configuration

$ git config --global user.name "[name]"

Sets the name to your commit transactions

$ git config --global user.email "[email address]"

Sets the email to your commit transactions

Create repositories

$ git init

To create a new git repository.

$ git remote add origin <url>

Add to Remote repository (Github, GitLab, Bitbucket etc.) from a local Git repository

$ git clone <url]>

Clone / Get a repository that already exists on (Github, GitLab, Bitbucket, etc.).

Synchronize

$ git fetch

Downloads history from the remote repository

$ git merge

Combines remote branches into the current local branch

$ git push

Uploads all local branch commits to (Github, GitLab, Bitbucket, etc.).

$ git pull

Updates the current local working branch with commits from the remote branch

Branches

$ git branch <branch-name>

Creates a new branch

$ git checkout <branch-name>

Switches to the <branch-name>

$ git merge <branch-name>

Combines the specified branch’s history into the current branch.

$ git branch -d <branch-name>

Deletes the <branch-name>