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: |

Launched in 2013, Telegram allows users to broadcast messages to a following via “channels”, or create public and private groups that are simple for others to access. Users can also send and receive large data files, including text and zip files, directly via the app.The platform said it has more than 500m active users, and topped 1bn downloads in August, according to data from SensorTower.

At a time when the Indian stock market is peaking and has rallied immensely compared to global markets, there are companies that have not performed in the last 10 years. These are definitely a minor portion of the market considering there are hundreds of stocks that have turned multibagger since 2020. What went wrong with these stocks? Reasons vary from corporate governance, sectoral weakness, company specific and so on. But the more important question is, are these stocks worth buying?

NET Internals from us


Telegram .NET Internals
FROM USA