0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git開発】HEADについての超メモ程度に振り返りしました。

Posted at

 Gitで、ブランチに対してpushしたりcommitしたり機会は多いと思いますが、git branchの結果に表示されるHEADについて改めて整理してみました。

(base) user@DESKTOP-C0A2DE7:~/Github_repo/my_repo$ git branch -a

* main
  readme_feature
  remotes/origin/HEAD -> origin/main
  remotes/origin/Life-Tech316-patch-1
  remotes/origin/feature2
  remotes/origin/main
  remotes/origin/readme_feature

ここでHEADとは「現在作業中のブランチを指し示すポインタ」になります。

ローカルだと
* mainという記載がありますが、これは
この * が付いている main が、現在の HEAD が指しているブランチという意味になります。

  remotes/origin/HEAD -> origin/main

**「GitHub 上の HEAD」**は mainブランチ を指している(GitHub上のデフォルトブランチが main)という意味になります。

GUI上からもレポジトリのデフォルトブランチは変更可能ですが、CLIからもデフォルトブランチを変更することは可能です。

gh repo edit --default-branch feature2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?