Git bisect Command
In this page:
git bisect start
git bisect bad [commit]
git bisect good [commit]
git bisect reset
Git Bisect शुरू करना
git bisect commits को एक-एक करके check करने के बजाय binary search इस्तेमाल करके exact commit ढूँढता है जिसने एक bug introduce किया। आप इसे git bisect start से शुरू करते हैं, फिर search range define करने के लिए अपनी current commit को git bisect bad mark करते हैं और एक known-working पुरानी commit को git bisect good <hash>।
उदाहरण: Starting Git Bisect
git bisect start
git bisect bad
git bisect good v1.0
Commits को Good और Bad Mark करना
range mark करने के बाद, Git good और bad के बीच वाली commit checkout करता है और इसे test करके git bisect good या git bisect bad से report करने का आपका wait करता है। हर answer बाकी बची range को आधा कर देता है, इसलिए एक हज़ार commits में छुपा एक bug आमतौर पर isolate होने में दस steps से कम लेता है।
उदाहरण: Marking Commits Good and Bad
git bisect good
git bisect bad
Bisect Run के साथ Automate करना
एक automatable check वाले bug के लिए हर step पर manually test और report करना tedious है — git bisect run <script> Git को हर commit खुद test करने देता है, एक zero exit code को "good" और non-zero को "bad" मानते हुए, और यह unattended पूरा चलकर culprit commit report करेगा।
उदाहरण: Automating with Bisect Run
git bisect run ./test.sh
Bisect Session Reset करना
git bisect reset session खत्म करता है और आपकी working directory को उस branch और commit पर वापस लाता है जिस पर आप शुरू करने से पहले थे — इस step को skip करना आपको bisect ने last में जो भी commit checkout किया था उस पर, एक detached-HEAD state में फँसा देता है।
उदाहरण: Resetting the Bisect Session
git bisect reset
Bisect Log देखना
git bisect log session के दौरान किए आपके हर good/bad judgment को print करता है, और उसी output को दूसरी machine पर या नई commits pull करने के बाद same bisect फिर से चलाने के लिए git bisect replay में वापस feed किया जा सकता है — किसी teammate के साथ एक reproducible investigation share करने के लिए handy।
उदाहरण: Viewing Bisect Log
git bisect log
git bisect replay bisect-log.txt
- गलत commit को
goodयाbadmark करना, ताकि bisect गलत commit की ओर point करे। - बाद में
git bisect resetभूल जाना और एक middle commit की detached-HEAD state में रह जाना। git bisect runको गलत exit codes return करने वाली एक script के साथ इस्तेमाल करना, जबकि0का मतलब good है और non-zero (1 से 127, 125 को छोड़कर) का मतलब bad।
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: