Skip to content

Commit

Permalink
Added new topic: Finding (k88hudson#168)
Browse files Browse the repository at this point in the history
* New Topic for 'Finding'

Added command which can be used to find a string in any commit

* Added command that can be used to find for commits either by author or committer

* Fixed link
  • Loading branch information
jcalvopinam authored and RichardLitt committed Dec 10, 2017
1 parent 472f05c commit 418f0a0
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ For clarity's sake all examples in this document use a customized bash prompt in
- [Stash specific files](#stash-specific-files)
- [Stash with message](#stash-with-message)
- [Apply a specific stash from list](#apply-a-specific-stash-from-list)
- [Finding](#finding)
- [I want to find a string in any commit](#i-want-to-find-a-string-in-any-commit)
- [I want to find by author/committer](#i-want-to-find-by-author-committer)
- [Miscellaneous Objects](#miscellaneous-objects)
- [Clone all submodules](#clone-all-submodules)
- [Remove a submodule](#remove-a-submodule)
Expand Down Expand Up @@ -865,7 +868,7 @@ Newer, awesomer features
# You are currently editing a commit while rebasing branch 'master' on '8074d12'.
#
# Changes to be committed:
# modified: README.md
# modified: README.md
#
```
Expand Down Expand Up @@ -999,6 +1002,7 @@ If at any time you want to stop the entire rebase and go back to the original st
```sh
(my-branch)$ git rebase --abort
```

<a name="stashing"></a>
## Stash

Expand Down Expand Up @@ -1056,6 +1060,37 @@ $ git stash apply "stash@{n}"

Here, 'n' indicates the position of the stash in the stack. The topmost stash will be position 0.

<a name="finding"></a>
## Finding

<a name="i-want-to-find-a-string-in-any-commit"></a>
### I want to find a string in any commit

To find a certain string which was introduced in any commit, you can use the following structure:

```sh
$ git log -S "string to find"
```

Commons parameters:

* `--source` means to show the ref name given on the command line by which each commit was reached.

* `--all` means to start from every branch.

* `--reverse` prints in reverse order, it means that will show the first commit that made the change.

<a name="i-want-to-find-by-author-committer"></a>
### I want to find by author/committer

To find all commits by author/committer you can use:

```sh
$ git log --author=<name or email>
$ git log --committer=<name or email>
```

Keep in mind that author and committer are not the same. The `--author` is the person who originally wrote the code; on the other hand, the `--committer`, is the person who committed the code on behalf of the original author.

<a name="miscellaneous-objects"></a>
## Miscellaneous Objects
Expand Down

0 comments on commit 418f0a0

Please sign in to comment.