Thursday, 23 July 2015

Textual Representation of logo

Top Underrated Git Commands

Here are the most important commands in git , and their description .

git reset –hard origin/master 
Resets your Local Repo with HEAD
git reflog
Displays a walkthrough of git cycle through out your local repo with commit references.
git cherry
Note: Cherry and Cherry-pick are two different commands, Cherry displays a list of commit differences between branches/remotes
e.g git cherry master staging OR git cherry -v staging
git cherry-pick
Adds a commit to your current branch.
git shortlog
Displays Author and no of commits.e.g git shortlog -s -n
git shortlog
Everyone of us must be knowing what git logs can do , Today lets trick it out a advanced feature of Git log.
Lets take an example , Some one have merged master with staging and pushed accidentally.
I want to know who did it , who merged the changes because git will say the commit author name.
To do so we need to run
git log --pretty='%T %s --Commiter: %cn --Author: %aN'
Other method would be to open gitg and check author and committer name.
Author name is who changed the content in file and commiter is who merged or changed the commit history to your branch.