Skip to content
This repository was archived by the owner on Jan 3, 2018. It is now read-only.

Add note about git log options #758

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions novice/git/01-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,48 @@ Date: Thu Aug 22 09:51:46 2013 -0400
~~~
{:class="out"}

> #### Log Options
>
> To avoid that `git log` cover all your terminal screen you can use the
> `--oneline` option:
>
> ~~~
> $ git log --oneline
> ~~~
> {:class="in"}
> ~~~
> * 005937f Thoughts about the climate
> * 34961b1 Concerns about Mars's moons on my furry friend
> * f22b25e Starting to think about Mars
> ~~~
> {:class="out"}
>
> You can also combine the `--oneline` options with others. One useful
> combination is
>
> ~~~
> $ git log --oneline --graph --all --decorate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--oneline is probably the most useful option at this point, maybe start with just that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--oneline is probably the most useful option at this point, maybe start with just that?

I don't want to expand this note too much. I hope that instructors already had
taught git help at this point so students can git help log and read what
--oneline, --graph, ... are for.

If more people believe that the write version of the lesson should have this
incremental mention of options I'm OK in change the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant that I think we ought to mention only --oneline and none of the other options.

> ~~~
> {:class="in"}
> ~~~
> * 005937f Thoughts about the climate (HEAD, master)
> * 34961b1 Concerns about Mars's moons on my furry friend
> * f22b25e Starting to think about Mars
> ~~~
> {:class="out"}
>
> You can also limit the number of commits to be printed:
>
> ~~~
> $ git log --oneline --graph --all --decorate -2
> ~~~
> {:class="in"}
> ~~~
> * 005937f Thoughts about the climate (HEAD, master)
> * 34961b1 Concerns about Mars's moons on my furry friend
> ~~~
> {:class="out"}

To recap, when we want to add changes to our repository,
we first need to add the changed files to the staging area
(`git add`) and then commit the staged changes to the
Expand Down