🔥 با کمک هوش مصنوعی در کمتر از 6 ماه فول‌استک شوید ...
۰ ثانیه
۰ دقیقه
۰ ساعت
۱ توران خت ظریف
نام مخزن اصلی main یا master
مهندس بهشته نعمت‌زاده حل شده توسط مهندس بهشته نعمت‌زاده

سلام

 

وقتی در گیت ریپازیتوری میسازیم، از دستورات زیر باید استفاده کنیم تا فایل‌ها رو به گیت منتقل کنیم

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/*****/test.git
git push -u origin main
git remote add origin https://github.com/*****/test.git
git branch -M main
git push -u origin main

حالا دستور git branch -M دقیقا چیکار میکنه؟

git branch [--color[=<when>] | --no-color] [--show-current]
               [-v [--abbrev=<n> | --no-abbrev]]
               [--column[=<options>] | --no-column] [--sort=<key>]
               [--merged [<commit>]] [--no-merged [<commit>]]
               [--contains [<commit>]] [--no-contains [<commit>]]
               [--points-at <object>] [--format=<format>]
               [(-r | --remotes) | (-a | --all)]
               [--list] [<pattern>...]
       git branch [--track | --no-track] [-f] <branchname> [<start-point>]
       git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
       git branch --unset-upstream [<branchname>]
       git branch (-m | -M) [<oldbranch>] <newbranch>
       git branch (-c | -C) [<oldbranch>] <newbranch>
       git branch (-d | -D) [-r] <branchname>...
       git branch --edit-description [<branchname>]

توی صفحه زیر هم توضیح کامل ندیدم: (یا بهتره بگم دقیق متوجه نشدم)

https://git-scm.com/docs/git-branch
##########
-m
--move
Move/rename a branch and the corresponding reflog.
-M
Shortcut for --move --force.

منظورش اینه که دیگه از این به بعد بجای master از main استفاده کنیم؟ باید سایر برنچ‌ها رو با کدوم merge کنیم؟

رضا جان سلام وقت بخیر

 

واژه مستر بخاطر قوانین نژاد پرستی جای خودشو به main داده و وقتی ریپاسیتوری میسازید در حقیقت به صورت پیشفرض برنچ main براتون ساخته میشه.

اطلاعات بیشتر : لینک

بهترین پاسخ
مهندس بهشته نعمت‌زاده ۲۶ مهر ۱۴۰۰، ۱۲:۴۳