Skip to content

Commit

Permalink
debug and started on patching
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Oct 13, 2014
1 parent 0cce6a4 commit a5033d3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
1 change: 1 addition & 0 deletions book/05-distributed-git/sections/maintaining.asc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $ git checkout -b sc/ruby_client master

Now you're ready to add your contributed work into this topic branch and determine if you want to merge it into your longer-term branches.

[[_patches_from_email]]
==== Applying Patches from E-mail

(((email, applying patches from)))
Expand Down
2 changes: 2 additions & 0 deletions book/07-git-tools/sections/debugging.asc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Git also provides a couple of tools to help you debug issues in your projects.
Because Git is designed to work with nearly any type of project, these tools are pretty generic, but they can often help you hunt for a bug or culprit when things go wrong.

[[_file_annotation]]
==== File Annotation

If you track down a bug in your code and want to know when it was introduced and why, file annotation is often your best tool.
Expand Down Expand Up @@ -62,6 +63,7 @@ This is really useful.
Normally, you get as the original commit the commit where you copied the code over, because that is the first time you touched those lines in this file.
Git tells you the original commit where you wrote those lines, even if it was in another file.

[[_binary_search]]
==== Binary Search

Annotating a file helps if you know where the issue is to begin with.
Expand Down
1 change: 1 addition & 0 deletions book/07-git-tools/sections/searching.asc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

With just about any size codebase, you'll often need to find where a function is called or defined, or find the history of a method. Git provides a couple of useful tools for looking through the code and commits stored in it's database quickly and easily. We'll go through a few of them.

[[_git_grep]]
==== Git Grep

Git ships with a command called `grep` that allows you to easily search through any committed tree or the working directory for a string or regular expression. For these examples, we'll look through the Git source code itself.
Expand Down
38 changes: 29 additions & 9 deletions book/C-git-commands/1-git-commands.asc
Original file line number Diff line number Diff line change
Expand Up @@ -318,32 +318,52 @@ The `git describe` command is used to take anything that resolves to a commit an

We use `git describe` in <<_build_number>> and <<_preparing_release>> to get a string to name our release file after.

=== Patching

==== apply
=== Debugging

==== cherry-pick
Git has a couple of commands that are used to help debug an issue in your code. This ranges from figuring out where something was introduced to figuring out who introduced it.

==== rebase
==== bisect

==== revert
The `git bisect` tool is an incredibly helpful debugging tool used to find which specific commit was the first one to introduce a bug or problem by doing an automatic binary search.

It is fully covered in <<_binary_search>> and is only mentioned in that section.

=== Debugging
==== blame

==== bisect
The `git blame` command annotates the lines of any file with which commit was the last one to introduce a change to each line of the file and what person authored that commit. This is helpful in order to find the person to ask for more information about a specific section of your code.

==== blame
It is covered in <<_file_annotation>> and is only mentioned in that section.

==== grep

The `git grep` command can help you find any string or regular expression in any of the files in your source code, even older versions of your project.

It is covered in <<_git_grep>> and is only mentioned in that section.

=== Patching

A few commands in Git are centered around the concept of thinking of commits in terms of the changes they introduce, as thought the commit series is a series of patches. These commands help you manage your branches in this manner.

==== cherry-pick

==== rebase

==== revert


=== Email

==== am
Many Git projects, including Git itself, are entirely maintained over mailing lists. Git has a number of tools built into it that help make this process easier, from generating patches you can easily email to applying those patches from an email box.

==== apply

The `git apply` command applies a patch created with the `git diff` or even GNU diff command. It is similar to what the `patch` command might do with a few small differences.

We demonstrate using it and the circumstances in which you might do so in <<_patches_from_email>>.

==== am

==== format-patch

==== send-email
Expand Down

0 comments on commit a5033d3

Please sign in to comment.