Actions

Difference between revisions of "開発者エリア/Gitデフォルトブランチを「master」から「main」に切り替える"

From Mahara Wiki

Line 9: Line 9:
 
<pre>
 
<pre>
 
# Switch to the "master" branch:
 
# Switch to the "master" branch:
 +
# 「master」ブランチに切り替える:
 
$ git checkout master
 
$ git checkout master
  
 
# Rename it to "main":
 
# Rename it to "main":
 +
# 「main」にリネームする:
 
$ git branch -m master main
 
$ git branch -m master main
  
 
# Get the latest commits (and branches!) from the remote:
 
# Get the latest commits (and branches!) from the remote:
 +
# リモートから最新のコミット (およびブランチ!) を取得する:
 
$ git fetch
 
$ git fetch
  
 
# Remove the existing tracking connection with "origin/master":
 
# Remove the existing tracking connection with "origin/master":
 +
# 既存の「origin/master」のトラッキング接続を解除する:
 
$ git branch --unset-upstream
 
$ git branch --unset-upstream
  
 
# Create a new tracking connection with the new "origin/main" branch:
 
# Create a new tracking connection with the new "origin/main" branch:
 +
# 新しい「origin/main」ブランチへのトラッキング接続を作成する:
 
$ git branch -u origin/main
 
$ git branch -u origin/main
 
</pre>
 
</pre>
  
For good measure, run  
+
For good measure, run
 +
念のため、以下のコマンドを実行する
  
 
   git pull
 
   git pull
  
 
once done just to get the latest code.
 
once done just to get the latest code.
 +
最新版コードを取得ために上のコマンドを1回だけ実行してください。
  
 
==Update the Gerrit hook==
 
==Update the Gerrit hook==

Revision as of 09:22, 29 May 2022

作成中です - mits (talk)

2021年10月14日、私たちはメインのGitブランチを「master」から「main」に切り替えました。すでに開発目的でローカルのMaharaインスタンスを動作させている場合、Gerritにコードを正しくプッシュするため、いくつか変更する必要があります。

あなたのローカルセットアップを新しいブランチを指すために変更する

以下のインストラクションは「How to change your master branch to main in Git 」(英語) から取得したものです。

# Switch to the "master" branch:
# 「master」ブランチに切り替える:
$ git checkout master

# Rename it to "main":
# 「main」にリネームする:
$ git branch -m master main

# Get the latest commits (and branches!) from the remote:
# リモートから最新のコミット (およびブランチ!) を取得する:
$ git fetch

# Remove the existing tracking connection with "origin/master":
# 既存の「origin/master」のトラッキング接続を解除する:
$ git branch --unset-upstream

# Create a new tracking connection with the new "origin/main" branch:
# 新しい「origin/main」ブランチへのトラッキング接続を作成する:
$ git branch -u origin/main

For good measure, run 念のため、以下のコマンドを実行する

 git pull

once done just to get the latest code. 最新版コードを取得ために上のコマンドを1回だけ実行してください。

Update the Gerrit hook

  1. Open the file 'post-checkout' in '.git/hooks'.
  2. Find 'master' and change it to 'main'.
  3. Save the file.