Besides the “basic” commands of Git, everyone has their own little Git tricks they use. I wanted to quickly write a list of my own which I tend to alias in my
hub is an extension to command-line git that helps you do everyday GitHub tasks without ever leaving the terminal.
Interested in learning Git? Learn Git Branching is the most visual and interactive way to learn Git on the web; you’ll be challenged with exciting levels, given step-by-step demonstrations of powerful features, and maybe even have a bit of fun along the way.
These tips and techniques by James Turnbull will help you to avoid potential source control pitfalls and make your development workflow bit smoother.
Tip # 6: I am bisect and so can you
git bisectis one of the most powerful, seemingly magical, code-based debugging tools available to you. It can be used when you discover a bug you can’t trace to a specific piece of code. A
git bisectruns a binary search between two commits: a good commit where the bug wasn’t present and a bad commit where the bug appears.
$ git bisect start $ git bisect bad # Current version is bad $ git bisect good v2.6.13-rc2 # v2.6.13-rc2 is known to be good
A searchable collection of the most frequently asked Git questions. Following are a couple of my most favorite commands from the list:
-- Commit changes to a new branch git checkout -b my-new-branch-name -- Move stashed changes to current branch git stash apply
Another handy Git command I surely want to see in this list is
git commit --amend which allows adding changes to your last commit.
-- Add changes to last commit git commit --amend -m "updated commit message"
--amend flag will tackle situation like:
701c70f Fix issue with api_handler 2e7be87 Update fix to api_handler 7e9f104 Some more fixes to api_handler 16e9747 Last changes to api_handler 3d1e7db This is last change to api_handler e58043e :(