> For the complete documentation index, see [llms.txt](https://zubi.gitbook.io/open-source-fiesta/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zubi.gitbook.io/open-source-fiesta/cheatsheet.md).

# Cheatsheet

### Create &#x20;

Clone an existing repository

`$ git clone ssh://userdomain.com/repo.git`

Create a new local repository

`$ git init`

### Local Changes &#x20;

View changed files in working directory

`$ git status`

Add all current changes to next commit

`$ git add .`

Add some changes to next commit

`$ git add -p <file>`

Commit previously staged changes with message

`$ git commit -m 'message'`

### Commit history &#x20;

Show all commits, starting with newest

`$ git log`

Who changed what and when in a file

`$ git blame <file>`

### Branches and tags &#x20;

List all existing branches

`$ git branch -av`

Switch HEAD branch

`$ git checkout <branch>`

### Update and publish &#x20;

List all currently configured remotes

`$ git remote -v`

Download changes and merge into HEAD

`$ git pull <remote> <branch>`

Publish local changes on a remote

`$ git push <remote> <branch>`

### Merge and rebase &#x20;

Merge branch into your current HEAD

`$ git remote -v`

Rebase your current HEAD onto branch (not for published commits)

`$ git rebase <branch>`

### Undo &#x20;

Discard all local changes in working directory

`$ git reset --hard HEAD`

Discard local changes in a specific file

`$ git checkout HEAD <file>`

Revert a commit

`$ git revert <commit>`

### Setting up profile

Using username

`$ git config --global user.name \'YOUR_USERNAME\'`

Using email

`$ git config --global user.email YOUR_EMAIL_HERE`

Checking you config settings

`$ git config --list`
