Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6211482
commit b982096
Showing
3 changed files
with
91 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
layout: post | ||
title: More Git Goodness | ||
tags: git | ||
category: Git | ||
--- | ||
|
||
## Git Show | ||
|
||
### Show a particular commit with git show | ||
|
||
|
||
This will show the commit as a diff. | ||
|
||
{% highlight bash %} | ||
git show HEAD^^^ | ||
{% endhighlight %} | ||
|
||
Also you can use the commit's sha1 as an argument | ||
{% highlight bash %} | ||
git show 62114826e3f | ||
{% endhighlight %} | ||
|
||
|
||
|
||
|
||
## Set git to output color | ||
|
||
{% highlight bash %} | ||
git config --local color.ui auto | ||
{% endhighlight %} | ||
|
||
|
||
This command adds the following to your .gitconfig file: | ||
|
||
{% highlight yaml %} | ||
[color] | ||
ui = auto | ||
{% endhighlight %} | ||
|
||
|
||
|
||
## Git Bisect | ||
|
||
Try to find where in the version history a bug first appeared. | ||
|
||
{% highlight bash %} | ||
# start bisect | ||
git bisect start | ||
# set good point: there was no bug here, this can be a tag, SHA1, or HEAD~18 ... | ||
git good v1.2.6 | ||
# set bad endpoint: we know it had shown up by here | ||
git bad master | ||
|
||
# bisect will select a commit half way between good and bad | ||
# test ... then tell git if its good or bad | ||
git bisect good | ||
# it will split the other half in half | ||
git bisect bad | ||
# when you've found the bad commit, reset the branch with | ||
git biset reset | ||
|
||
{% endhighlight %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
If you've ever played keywiz on Emacs: "M-x keywiz", you were probably eating humble-hacker-pie by the end of the game. (For the uninitiated, keywiz is a game in emacs that's asks 10 random questions about key-bindings for some times obscure emacs commands.) So far my top score is 4 (out of 10).<br /><br />So what is a novice to do? I've decided to write commands I want to learn on sticky notes on my monitor until I memorize them.<br /><br />So, without further ado, here's this weeks list of new commands:<br /><br />M-g g<br />goto line. This command will ask for a line number and take you there in the current file.<br /><br />C-x v=<br />vc-diff. This command will show a diff between current file and HEAD in whatever Version Control System you are using.<br /><br />C-x vv<br />vc-next-action. This command will perform the next appropriate VCS command, such as add current file to staging, or commit.<br /><br />C-M-\<br />indent-region. If there is a defined region, this command will indent it.<br /><br />C-M-;comment-region. If there is a defined region, this command will comment the region out. (or uncomment a commented out region.)<br /><br />A note: to define a region. Do a C-[spc] at the beginning of the region and then move to the end of the region however you'd like (arrow keys, C-n, C-f, C-v). If you can't see the regions add the following to your .emacs file: (transient-mark-mode 1).<br /><br />Second note, in the above key combination, capital C, means hold the Ctrl key, capital M, means hold the Alt key. If there are dashes between letters: type them together (or with C or M hold the Ctrl or Alt key while typing the other key. So with M-g g: Hold Alt while typing g, let go and then type g again.)<br /><br />Now off to work on a new version of keywiz, perhaps keywiz-jr!<br /><br /><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-8672382218947955063?l=denverdroid.blogspot.com' alt='' /></div> | ||
If you've ever played keywiz on Emacs: "M-x keywiz", you were probably eating humble-hacker-pie by the end of the game. (For the uninitiated, keywiz is a game in emacs that's asks 10 random questions about key-bindings for some times obscure emacs commands.) So far my top score is 4 (out of 10). | ||
|
||
So what is a novice to do? I've decided to write commands I want to learn on sticky notes on my monitor until I memorize them. | ||
|
||
So, without further ado, here's this weeks list of new commands: | ||
|
||
M-g g | ||
goto line. This command will ask for a line number and take you there in the current file. | ||
|
||
<h3>C-x v=</h3> | ||
vc-diff. This command will show a diff between current file and HEAD in whatever Version Control System you are using. | ||
|
||
<h3>C-x vv</h3> | ||
vc-next-action. This command will perform the next appropriate VCS command, such as add current file to staging, or commit. | ||
|
||
<h3>C-M-\</h3> | ||
indent-region. If there is a defined region, this command will indent it. | ||
|
||
<h3>C-M-;</h3> | ||
comment-region. If there is a defined region, this command will comment the region out. (or uncomment a commented out region.) | ||
|
||
A note: to define a region. Do a C-[spc] at the beginning of the region and then move to the end of the region however you'd like (arrow keys, C-n, C-f, C-v). If you can't see the regions add the following to your .emacs file: (transient-mark-mode 1). | ||
|
||
Second note, in the above key combination, capital C, means hold the Ctrl key, capital M, means hold the Alt key. If there are dashes between letters: type them together (or with C or M hold the Ctrl or Alt key while typing the other key. So with M-g g: Hold Alt while typing g, let go and then type g again.) | ||
|
||
Now off to work on a new version of keywiz, perhaps keywiz-jr! | ||
|
||
<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-8672382218947955063?l=denverdroid.blogspot.com' alt='' /></div> |