git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-reflog.txt: add an EXAMPLES section

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Oct 3, 2022, 08:46 UTC
Message-ID
<20221003084654.183966-1-gitter.spiros@gmail.com>

This commit adds an "EXAMPLES" section to the git reflog man page. This new section currently provides examples of using git reflog with branches, for which doubts often exist. In this commit we also add a "SEE ALSO" section which refers to further information on git commands or documentation referenced in the git reflog man page.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 Documentation/git-reflog.txt | 42 ++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
index 70791b9fd8..5bbd5958fe 100644
--- a/Documentation/git-reflog.txt
+++ b/Documentation/git-reflog.txt
@@ -96,6 +96,48 @@ them.
 --verbose::
 	Print extra information on screen.
 
+EXAMPLES
+--------
+
+`git reflog`::
+	Lists entries of reflog of HEAD, starting at `HEAD@{0}`.
+
+`git reflog HEAD`::
+	The same.
+
+`git reflog show HEAD`::
+	The same.
+
+`git reflog HEAD@{4}`::
+	The same, starting at the 4th prior value of HEAD.
+
+`git reflog master`::
+	Lists entries of reflog of `master`.
+
+`git reflog master@{0}`::
+	The same.
+
+`git reflog master@{now}`::
+	The same, show with timestamp.
+
+`git reflog master@{4.minutes}`::
+	The same, starting at master, 4 minutes ago.
+
+For the branch that is currently checked out, you can omit the name
+when you use any of the @{..} notation, so
+
+`git reflog @{0}`
+
+`git reflog @{now}`
+
+are often the easiest ways to view what you did on the current
+branch
+
+SEE ALSO
+--------
+linkgit:gitrevisions[7],
+linkgit:git-log[1]
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
2.37.3
Next: Ævar Arnfjörð Bjarmason
Message 1 of 7 in “git-reflog.txt: add an EXAMPLES section”
  1. git-reflog.txt: add an EXAMPLES sectionElia Pinto, Oct 3, 2022
  2. Ævar Arnfjörð BjarmasonOct 3, 2022
  3. Elia PintoOct 3, 2022
  4. Junio C HamanoOct 3, 2022
  5. Junio C HamanoOct 3, 2022
  6. Bagas SanjayaOct 3, 2022
  7. Junio C HamanoOct 3, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.