Saturday, June 22, 2013

Git: The most commonly used git commands


On my daily bases working with git (DVCS), I found that the most common commands I am using every time are the following commands.

And I have made some aliases for some of them for eases of access and use; check this link on how to make aliases or shortcuts for your commands.

Command

Work description

add    

Add file contents to the index. When new or modified files are ready for the next commit, they must first be staged with the add command. Files can be staged one by one, by folder name, or by wildcard pattern.

bisect 

Find by binary search the change that introduced a bug

branch 

List, create, or delete branches

checkout

Checkout a branch or paths to the working tree

clone  

Clone a repository into a new directory

commit 

Once all desired files are added and staged, a commit command transactionally saves the pending additions to the local repository.

diff   

Show changes between commits, commit and working tree, etc

fetch  

Download objects and refs from another repository

grep   

Print lines matching a pattern

init

Create an empty Git repository or reinitialize an existing one

log    

Show commit logs

merge

Join two or more development histories together

mv

Move or rename a file, a directory, or a symlink

pull

Fetch from and merge with another repository or a local branch

push   

Update remote refs along with associated objects

rebase 

Rebasing is the rewinding of existing commits on a branch with the intent of moving the branch start point forward, then replaying the rewound commits. This allows developers to test their branch changes safely in isolation on their private branch just as if they were made on top of the mainline code, including any recent mainline bug fixes.

reset  

Reset current HEAD to the specified state

rm

Remove files from the working tree and from the index

show   

Show various types of objects

status 

Show the working tree status, and check the current status of a project’s local directories and files, such as modified, new, deleted, or untracked.

tag    

Git provides tagging to mark a specific commit in your timeline of changes, and serve as a useful identifier in history. A tag can be created for any commit in history by passing the commit hash. If no commit hash is provided, the most recent commit (i.e. HEAD) will be used by default.


For more information of each command and its related options, from command line on windows or terminal on Mac issue the following command

'git help ' to See more information on a specific command.

No comments :

Post a Comment