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.


Work description


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.


Find by binary search the change that introduced a bug


List, create, or delete branches


Checkout a branch or paths to the working tree


Clone a repository into a new directory


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


Show changes between commits, commit and working tree, etc


Download objects and refs from another repository


Print lines matching a pattern


Create an empty Git repository or reinitialize an existing one


Show commit logs


Join two or more development histories together


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


Fetch from and merge with another repository or a local branch


Update remote refs along with associated objects


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 current HEAD to the specified state


Remove files from the working tree and from the index


Show various types of objects


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.


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