Git log Command
In this page:
git log
git log --oneline
git log -n number
git log --author="name"
Commit History देखना
git log आपकी commit history में backward चलता है, सबसे नई पहले, हर commit का पूरा hash, author, date, और message print करते हुए -- सिर्फ एक quick overview चाहिए होने पर हर entry को एक single line में compress करने के लिए --oneline add करें।
उदाहरण: Viewing Commit History
git log
git log --oneline
Log Output Limit करना
एक long-running project पर पूरा log हज़ारों entries तक फैल सकता है, इसलिए git log -n 5 (या कोई भी संख्या) output को सिर्फ सबसे हाल की commits तक limit करता है, जो आमतौर पर वही है जो actually आपको check करने के लिए चाहिए।
उदाहरण: Limiting the Log Output
git log -n 5
Author से Logs Filter करना
एक team project पर, git log --author="name" history को एक specific person की commits तक filter करता है, जो किसी के हाल के काम को review करने या यह track करने के लिए उपयोगी है कि किसने एक particular area को छुआ।
उदाहरण: Filtering Logs by Author
git log --author="Priya"
Date से Logs Filter करना
git log --since="2 weeks ago" --until="yesterday" (या specific dates) commits को एक date range तक filter करता है, जो exactly review करने का सबसे तेज़ तरीका है कि एक sprint के दौरान या एक release से पहले क्या बदला।
उदाहरण: Filtering Logs by Date
git log --since="2 weeks ago" --until="yesterday"
Graphs से History Visualize करना
git log --graph --oneline --all एक ASCII diagram draw करता है कि आपकी branches समय के साथ कैसे diverge और merge हुईं, एक अन्यथा linear list को एक visual map में बदल देते हुए जो complex branching history follow करना कहीं आसान बना देता है।
उदाहरण: Visualizing History with Graphs
git log --graph --oneline --all
- पूरे
git logoutput में scroll करना, जबकिgit log --onelineप्रति commit एक line देता है। - pager में गलत keys दबाना और यह न जानना कि
qइससे exit करता है। - यह उम्मीद करना कि
git logदूसरी branches से commits दिखाएगा, जबकि यह सिर्फ current से reachable history दिखाता है जब तक आप--allइस्तेमाल न करें।
Chapter Quiz — Complete all 18 topics to unlock
0/18 topics done
Complete these topics first:
- Git init Command
- Git New Files
- Git Staging Environment
- Git clone Command
- Git status Command
- Git help Command
- Git add Command
- Git commit Command
- Git tags Command
- Git stash Command
- Git log Command
- Git diff Command
- Git show Command
- Git rm Command
- Git mv Command
- Git restore Command
- Git clean Command
- Git ignore (.gitignore)