Git

Create

Create an existing repository

git clone ssh://[email protected]/repo.git

Create a new local repository

git init

Local changes

Changed files in your working directory

git status

Changes to tracked files

git diff

Add all current changes to the next commit

git add .

Add some changes in <file> to the next commit

git add -p <file>

Commit all local changes in tracked files

git commit -a

Commit previously staged changes

Change the last commit

Don‘t amend published commits!

Commit history

Show all commits, starting with newest

Show changes over time for a specific file

Who changed what and when in

Branchs and Tags

List all existing branches

Switch HEAD branch

Create a new branch based on your current HEAD

Create a new tracking branch based on a remote branch

Delete a local branch

Mark the current commit with a tag

Update and Publish

List all currently configured remotes

Show information about a remote

Add new remote repository, named <remote>

Download all changes from <remote>, but don‘t integrate into HEAD

Download changes and directly merge / integrate into HEAD

Publish local changes on a remote

Delete a branch on the remote

Publish your tags

Merge and Rebase

Merge <branch> into your current HEAD

Rebase your current HEAD onto <branch>

Don‘t rebase published commits!

Abort a rebase

Continue a rebase after resolving conflicts

Use your configured merge tool to solve conflicts

Use your editor to manually solve conflicts and (after resolving) mark file as resolved

Undo

Discard all local changes in your working directory

Discard local changes in a specific file

Revert a commit

by producing a new commit with contrary changes

Reset your HEAD pointer to a previous commit …and discard all changes since then

... and preserve all changes as unstaged changes

... and preserve uncommitted local changes

Help and Documentation

Last updated

Was this helpful?