$git checkout
Please let me know if you agree with me about the behavior when I do it
Another person edited the A branch that I edited before, and I decided to edit it again.
$git fetch
$ git checkout A-brunch
"Huh? I didn't merge it, but it's reflected locally?"
I was confused, so I looked it up and came to this point.
The above is the answer I gave you, but is this correct?
And if this is correct, git looks inside the tracking branch when checking out
Does it mean that it will be consistent and move to the latest commit?
Thank you for your cooperation.
Branches are not a series of commits, but rather the latest commits.
It is recognized.It's officially called a pointer.
Git - Branch - What is a Branch?
First of all, fetch, so there is something local that represents the latest remote situation.
It also maintains a remote state locally as recognized,
There is a remote tracking branch.
Git-Branch Features-Remote Branch
I checked out after 2, so I switched to the latest A branch, that is, the latest commit.
Branch A is up to date, so HEAD is there and local is up to date.
The $git checkout branch
command has a hidden shortcut to switch to the latest commit.
Usually, it's just a function to switch to that branch.
If a branch with that name does not exist locally and a branch with the same name exists in the remote tracking branch,
$git checkout-b branch -- track origin/branch
The shortcut function is activated.
Therefore, as the questioner has confirmed, a branch will be created that is the HEAD of the commit that already exists remotely.
Reference
Git-git-checkout
Please check the official website (including English) and learn it.
877 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 Understanding How to Configure Google API Key
601 Uncaught (inpromise) Error on Electron: An object could not be cloned
595 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.