

Branch '4.0-branch' set up to track remote branch '4.0-branch' from 'origin'. The output will let you know that the command has been executed successfully. To do that, you will need to use the -b option and supply the branch’s path from the origin.Įxample: git checkout -b 4.0-branch origin/4.0-branch Most likely, you want to clone the remote branch and switch to it without being in the detached head state. This will pipe the output back to the console instead of using Less to process the page of data.Įxample: git -no-pager branch -r Check Out the Remote Branch for the First Time You can also add the –no-pager option, immediately after ‘git’, before the other options in the Git command line.

To exit Less and return to the command shell, press the q keyboard. Tip: By default, Git will send the output to a program named “Less” that can be used to edit text. You now want to list out the remote branches available for you to checkout with the branch command, using the -r option to list out the remote branches. To ensure that your local copy of the repository matches the remote one, use the fetch command to retrieve the origin.Įxample: git fetch origin List the Remote Branches Available to Checkout git clone Retrieving the Original Remote Repository Clone the Remote Repository if you have not already.Įxample: This clones the WordPress Repository on GitHub.
#Git checkout file from branch how to#
This tutorial will explain how to do that step by step. Checking out a remote branch can be surprisingly difficult due to Git’s complexity.
