Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-ls-tree, git-rev-list, git-rev-parse: add pages #3644

Merged
merged 11 commits into from
Dec 17, 2019
16 changes: 16 additions & 0 deletions pages/common/git-ls-tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# git ls-tree

> List the contents of a tree object.
> More information: <https://git-scm.com/docs/git-ls-tree>.

- List the contents of the tree on a branch:

`git ls-tree {{branch_name}}`

- List the contents of the tree on a commit and recurse into subtrees:
BeLi4L marked this conversation as resolved.
Show resolved Hide resolved

`git ls-tree -r {{commit_hash}}`

- List the contents of the tree on a commit and show only filenames:

`git ls-tree --name-only {{HEAD~3}}`
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change HEAD~3 to HEAD~N and note it shows the situation N commits ago or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

a2c3e61

Copy link
Contributor

@zlatanvasovic zlatanvasovic Dec 5, 2019

Choose a reason for hiding this comment

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

I would rather not put it as {{{HEAD}}~{{N}}. Maybe just HEAD~{{N}}?

/cc @waldyrious what would be the proper syntax here?

Copy link
Member

Choose a reason for hiding this comment

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

@BeLi4L maybe wait for a consensus to emerge in these discussions before applying the changes, otherwise you may need to do a lot of back and forth 😅

As for the syntax, I'm afraid we're making things too complex. The syntax for relative references is not something that this page is responsible for introducing. My suggestion is to simply include the 3 in the command description, and use {{HEAD~3}} as the token, rather than generalize with N. WDYT?

Copy link
Member

@waldyrious waldyrious Dec 6, 2019

Choose a reason for hiding this comment

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

Or maybe we could bypass this conundrum altogether by using another type of reference, like a tag (e.g. {{v1.2.3}}).

Copy link
Member

Choose a reason for hiding this comment

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

@zdroid I'd like to know what you dislike about using a tag, in light of my comments above.

Copy link
Member

Choose a reason for hiding this comment

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

Isn't the term commit-ish used in the man pages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any news on this? I can use commit-ish if you're all OK with that

Copy link
Contributor

Choose a reason for hiding this comment

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

The current version is fine with me. Maybe @sbrl wants to use "commit-ish" instead, both work for me.

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind. Either work for me.

16 changes: 16 additions & 0 deletions pages/common/git-rev-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# git rev-list

> Lists commits in reverse chronological order.
waldyrious marked this conversation as resolved.
Show resolved Hide resolved
> More information: <https://git-scm.com/docs/git-rev-list>.

- List all commits on current branch:
BeLi4L marked this conversation as resolved.
Show resolved Hide resolved

`git rev-list {{HEAD}}`
waldyrious marked this conversation as resolved.
Show resolved Hide resolved

- List commits more recent than a specific date, on a specific branch:

`git rev-list --since={{'2019-12-01 00:00:00'}} {{master}}`

- List all merge commits on a specific commit:

`git rev-list --merges {{commit}}`
12 changes: 12 additions & 0 deletions pages/common/git-rev-parse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# git rev-parse

> Parses a revision.
waldyrious marked this conversation as resolved.
Show resolved Hide resolved
> More information: <https://git-scm.com/docs/git-rev-parse>.

- Get the absolute path to the root directory:
waldyrious marked this conversation as resolved.
Show resolved Hide resolved

`git rev-parse --show-toplevel`

- Get the current branch name:

`git rev-parse --abbrev-ref {{HEAD}}`
waldyrious marked this conversation as resolved.
Show resolved Hide resolved