সোমবার সকালে দেখা গেল, একটা ভুল merge ইতিমধ্যে main-এ push হয়ে গেছে। নুসরাত আতঙ্কে git reset চালাতে যাচ্ছিল; মাহিন থামিয়ে বলল, shared ইতিহাস reset করলে সবার লোকাল কপি ভেঙে যাবে। নিরাপদ পথ হলো merge commit-টা git revert -m 1 দিয়ে উল্টে দেওয়া, যাতে পুরনো ইতিহাস অটুট থাকে। পুরনো head হারায় না, কারণ reflog ডিফল্ট মেয়াদে সেটা ধরে রাখে।
প্রথম লাইনে history <n>; পরের লাইনে nটি hash স্পেস দিয়ে আলাদা, শেষটা merge commit। তারপর merge <hash>, first-parent <hash>, pushed yes|no, already-reverted yes|no।
আউটপুট চার লাইন: cmd=<কমান্ড> (আগেই revert হয়ে থাকলে none; pushed হলে git revert -m 1 <hash>; না হলে git reset --hard <first-parent>), commits=<ফলাফলের commit সংখ্যা>, history=<ফলাফলের hash গুলো, খালি হলে ->, আর note=reflog-keeps-old-head।
ছয় লাইন: history <n>, তারপর nটি hash এক লাইনে, তারপর merge, first-parent, pushed, already-reverted।
Write your solution, test it against custom input, then submit for a real verdict.
Your submissions, verdicts, drafts and contest score are tied to your account. Registration is free.
চার লাইন: cmd=..., commits=..., history=..., note=reflog-keeps-old-head।
2 <= n <= 5000
merge commit ইতিহাসের শেষ। hash-এ স্পেস নেই। আউটপুটের লাইন-ক্রম ঠিক রাখতে হবে।
history 5 c1 c2 c3 c4 m1 merge m1 first-parent c4 pushed yes already-reverted no
cmd=git revert -m 1 m1 commits=6 history=c1 c2 c3 c4 m1 m1-revert note=reflog-keeps-old-head
history 4 a1 a2 a3 a4 merge a4 first-parent a3 pushed no already-reverted no
cmd=git reset --hard a3 commits=3 history=a1 a2 a3 note=reflog-keeps-old-head