CREAT (create)

Git init: Create a new local repository

Git clone SSH ://[email protected]/ rebo. git clone an existing repository.

The Configuration (Configuration)

Git config [–global] user.name Set the name attached to all your commits

Git config [–global] user.email Set the email attached to all your commits

Git config –global color. UI auto Set the color of command line output for all repos

Git config [–global] user.name Print set name(in current repository or globally)

Git config [–global] user.email Obtain the globally secure email address (Print set email(in current repository or))

Local Changes

Git status List changed files in your working directory

Git diff: List changed to tracked files

Git add Add all current changes in file to the next commit

Git add. Add all current changes to the next commit

Git mv Rename file and add it to next commit

Git rm Delete the file and add the deletion to the next commit.

Git commit -a Commit all local changes in Tracked files

Commit History

Git log Shows all commits

Git log -p Shwo changes over time for a specific file

Git log –author=

Show changes over time for a specific committer

Git blame

Who changed what and when in file

Temporarily view temporary file changes (Store changes)

Git stash pop Remove and apply changes

Git rm –cached

Delete the file from previous commits but retain it locally

Branches & Tags

Git branch List of all existing branches

Git checkout

Git branch

Create a new branch

Git branch –track


Create a new branch based on a remote branch

Git branch -d

Git branch origin –delete a remote branch

Git push

: Rename a branch on remote

 git push <remote> <new name>           

Git tag

git tag

Update & Publish

Git remote -v (List all currently configured remotes)

Git remote show

Git remote add


Git remote rename

Git fetch

Update all changes from remote,but don’t merge into HEAD

Git fetch -p

Download all changes to fromm remote,but don’t merge in HEAD and clean up deleted branchs from origin

Git pull


Update data from remote libraries and merge data immediately (Download changes and directly merge into HEAD)

Git push


Publish local changes on a remote

Git remote add –track




Git push — Tags Publish your tags to remote libraries

Git remote show

Merge & Rebase(branch merging and refactoring data)

Git merge

Merge branches into your current HEAD

Git rebase

rebase your current HEAD onto branch and sort it in order of commit

Git rebase — Abort the current merge

Git rebase — Continue a rebase after resolving conflicts to resolve confilcys

Git MergeTool Resolve conflicts using your configured mergetool

Git add < resolution-file > Manually resolve conflicts using the editor and mark resolved files

git rm <resolved-file>

Undo (dropped)

Git reset –hard HEAD Discard all local changes in your working directory

Git checkout HEAD

Discard local changes in a specific file

Git revert

Undo a commit by providing a new commit with contrary changes

Git checkout


Undo a specific file from a previous commit

Reset your HEAD pointer to a previous commit

Git reset –hard

Discarding local changes

Git reset

Rewind to a version and save the untraced changes

Git reset –keep

Rollback to a version and save the uncommitted changes