Most used Git commands

The most used commands in Git console which are used by me in projects. The reference is often overwhelmed with information which hinders me to use it in practice. This text is the place to keep working examples for quick reference instead of looking them up from somewhere in the internet.

All examples presume a local and a remote repositories which might be maintained simultaneously in most of cases. Also you should take a note that all commands are prefixed with ‘git’ so the whole command should look like the following ‘git <command> <options> <parameters>’.

Task Commands
Reset current branch to specific commit (details)
Discard changes in current branch
Create a new branch
The first command creates a local branch. The second command creates a remote one.
Delete a branch
The first command deletes a remote branch, The second command deletes a local one.
List local and remote branches & update the list of remote branches
It shows branches in local and remote repositories.
Switch to another local branch
Merge another branch to the current one
Compare local with remote
Delete local and remote branches
Get all merge commits from branches
Revert one file to a specific commit

 




No Comments


You can leave the first : )



Leave a Reply