Git is a version control system used widely for source code management. But before exploring some less known git commands have a look at some of the most commonly used commands here. Go have a look, I will wait!!!
Ah, You are back. So, lets get into some awesome less known git commands.
Git Short Log :
Get a summarized 'git log' output.
It returns the commit logs grouped by author.
Git Reverting :
Revert the existing commits and add new changes and commits to the reverted record.
Useful for reverting the faulty commits made.
Git CITOOL :
A graphical alternative to git commit.
Git Diffing :
Equivalent to diff command in Linux.
Shows the diff or changes between the commits or a commit and a working tree.
Extremely handy for getting to know the changes made to the commit or a working tree.
Git Greping :
Equivalent to grep command in Linux.
This searches your current directory for a pattern and prints the lines matching the pattern.
Extremely helpful for searching a particular keyword or pattern in your working directory.
Git Notes :
Adds, removes, or reads notes attached to objects, without touching the objects themselves.
They are used for adding information to commits which was not available during commiting.
This command adds notes to the last commit. You can also specify the commit you want notes to be added.
Shows the notes added to the commit.
Git Stashing :
Stash your current changes of the directory away in a dirty local directory.
It record your current state and index and takes you back to a clean working directory. It copies your local modifications away.
To list the stashed changes away.
To apply the stashed changes.
To stash the changes to some directory. Equivalent to git stash save
Git Blaming :
This is one of most useful, least known command.
This basically lists what revision or author modified each line of code.
Lists a detailed list specifying what revision and author modified each line of code in the file name.
Git Bisecting :
Uses binary search, to find a change that introduced a bug.
Extremely helpful in tracking down the change that had lead to a bug.
Has a lot of sub commands and options.
Check the complete explanation here
Git Rebasing :
Forward-port local commits to the updated upstream head.
More can be found here.
That's all for now.
Keep Hacking!!!
Ah, You are back. So, lets get into some awesome less known git commands.
Git Short Log :
Get a summarized 'git log' output.
It returns the commit logs grouped by author.
git shortlog
Git Reverting :
Revert the existing commits and add new changes and commits to the reverted record.
Useful for reverting the faulty commits made.
git revert HEAD~2Revert the changes specified by 3rd last commit in HEAD and create a new commit with reverted record/changes.
git revert -n master~4..master~1Revert the changes specified from 5th Last commit in HEAD to the 2nd Last commit in HEAD and do not create a new commit with reverted changes.
Git CITOOL :
A graphical alternative to git commit.
git citool
Git Diffing :
Equivalent to diff command in Linux.
Shows the diff or changes between the commits or a commit and a working tree.
Extremely handy for getting to know the changes made to the commit or a working tree.
git diffFor further details for the diff command : Go here
Git Greping :
Equivalent to grep command in Linux.
This searches your current directory for a pattern and prints the lines matching the pattern.
Extremely helpful for searching a particular keyword or pattern in your working directory.
git grep #defineSearches for the pattern #define in the current working got directory and prints all the lines matching #define.
Git Notes :
Adds, removes, or reads notes attached to objects, without touching the objects themselves.
They are used for adding information to commits which was not available during commiting.
git notes add -m 'Tested by Rajeev N B'
This command adds notes to the last commit. You can also specify the commit you want notes to be added.
git show -s
Shows the notes added to the commit.
Git Stashing :
Stash your current changes of the directory away in a dirty local directory.
It record your current state and index and takes you back to a clean working directory. It copies your local modifications away.
git stash list
To list the stashed changes away.
git stash apply
To apply the stashed changes.
git stash
To stash the changes to some directory. Equivalent to git stash save
Git Blaming :
This is one of most useful, least known command.
This basically lists what revision or author modified each line of code.
git blame
Lists a detailed list specifying what revision and author modified each line of code in the file name.
Git Bisecting :
Uses binary search, to find a change that introduced a bug.
Extremely helpful in tracking down the change that had lead to a bug.
git bisect
Has a lot of sub commands and options.
Check the complete explanation here
Git Rebasing :
Forward-port local commits to the updated upstream head.
More can be found here.
That's all for now.
Keep Hacking!!!
For any Doubts/ Clarifications/Feedback write to me @
or Connect me on Twitter @rBharshetty
No comments:
Post a Comment