Telegram Group & Telegram Channel
چیکار کنیم وقتی به اشتباه تو برنچ main پوش میکنیم؟!

دیروز داشتم کد میزدم و پوش میکردم یهو دیدم که دارم توی برنچ main پوش میکنم!!!

داشتیم pair-programming میکردیم و اصلا حواسم نبود ولی خوب همیشه یه راهی باید باشه، نه؟

باید این مراحل رو انجام بدیم:

1- پیدا کردن کامیت آخرین کامیت درست
git log --oneline
با این دستور تاریخچه کامیت ها رو میتونیم ببینیم
path\to\repo> git log --oneline
e74c0b4 (HEAD -> main) by mistake commit 2
d86e63f by mistake commit 1
ed658f3 latest good commit
7975f4e previous commits


2- تغییر برنج به کامیت درست
git reset --hard <commit-hash>

طبق تاریخچه بالا میخوایم به کامیت ed658f3 برگردیم پس:
git reset --hard ed658f3


3- پوش کردن تغییرات
با این دستور برنچ main رو آپدیت میکنیم
git push origin main --force

و تمام!

خوب چندتا سوال پیش میاد؟
1- چرا من تونسته بودم مستقیم روی برنچ main پوش کنم؟
چون ادمین ریپو هستم

2- خوب چرا پوش رو نبستی روی main؟
چون گیتاپ اگر بخوای Rule ست کنی برای ریپوی خصوصی باید گیتاپ Enterprise داشته باشی



tg-me.com/dotnet_internals/72
Create:
Last Update:

چیکار کنیم وقتی به اشتباه تو برنچ main پوش میکنیم؟!

دیروز داشتم کد میزدم و پوش میکردم یهو دیدم که دارم توی برنچ main پوش میکنم!!!

داشتیم pair-programming میکردیم و اصلا حواسم نبود ولی خوب همیشه یه راهی باید باشه، نه؟

باید این مراحل رو انجام بدیم:

1- پیدا کردن کامیت آخرین کامیت درست
git log --oneline
با این دستور تاریخچه کامیت ها رو میتونیم ببینیم

path\to\repo> git log --oneline
e74c0b4 (HEAD -> main) by mistake commit 2
d86e63f by mistake commit 1
ed658f3 latest good commit
7975f4e previous commits


2- تغییر برنج به کامیت درست
git reset --hard <commit-hash>

طبق تاریخچه بالا میخوایم به کامیت ed658f3 برگردیم پس:
git reset --hard ed658f3


3- پوش کردن تغییرات
با این دستور برنچ main رو آپدیت میکنیم
git push origin main --force

و تمام!

خوب چندتا سوال پیش میاد؟
1- چرا من تونسته بودم مستقیم روی برنچ main پوش کنم؟
چون ادمین ریپو هستم

2- خوب چرا پوش رو نبستی روی main؟
چون گیتاپ اگر بخوای Rule ست کنی برای ریپوی خصوصی باید گیتاپ Enterprise داشته باشی

BY .NET Internals




Share with your friend now:
tg-me.com/dotnet_internals/72

View MORE
Open in Telegram


NET Internals Telegram | DID YOU KNOW?

Date: |

For some time, Mr. Durov and a few dozen staffers had no fixed headquarters, but rather traveled the world, setting up shop in one city after another, he told the Journal in 2016. The company now has its operational base in Dubai, though it says it doesn’t keep servers there.Mr. Durov maintains a yearslong friendship from his VK days with actor and tech investor Jared Leto, with whom he shares an ascetic lifestyle that eschews meat and alcohol.

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

NET Internals from us


Telegram .NET Internals
FROM USA