The git checkout command performs two functionalities "switch branch" and "restore working tree files". The git switch command replaced git checkout in 2020, although git checkout is still a supported command. It will also set up a tracking relationship between your remote and local branch so that git pull and git push will work as intended. It will then create a local branch with the same name. When Git is unable to find this branch in your local repository, it will assume that you want to checkout the respective remote branch with the same name. If you want to switch to a remote branch that does not exist as local branch in your local working directory, you can simply execute git switch remoteBranch. You might have noticed that it is the same command used to switch to a local branch. Then use the same command git checkout RemoteBranchName to switch to remote branch. To checkout a remote branch, you will need to fetch the contents of the branch using git fetch –all first.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |