これらの違いをなかなか覚えられないので、忘備録的にここに記しておきます。
What is the difference between origin and main on git?
Great question! Let's break it down simply:
🔹 main
-
mainis the name of a branch — usually the default branch in most Git repositories today. -
It's where the main code lives (like "master" used to be).
-
You can have many branches in a project (e.g.
feature-x,dev,bugfix-123), butmainis often the primary one.
🔹 origin
-
originis the nickname for the remote repository — usually the one you cloned from. -
It's not a branch — it's a reference to the remote location, like GitHub.
-
You can push/pull code between your local repo and
origin.
🧠 Example: What does this mean?
This means:
"Push my local
mainbranch to theoriginremote (usually GitHub)."
🧪 You can also see what branches and remotes exist:
-
To see branches:
-
To see remotes:
Let me know if you want a visual of how local vs remote works or how branching fits in!
