AKZN Notes

Archives for My Lazy and Forgetful Mind

How to pull new branch from github

To pull a new branch from GitHub, follow these steps using Git:

1. Fetch the new branch from the remote repository:

Run the following command to fetch all branches from the remote repository. This will not switch to the branch yet, but it will download the branch references.

   git fetch origin

2. List all branches (optional):

You can list both local and remote branches to confirm the existence of the new branch.

   git branch -a

This will display both local branches and remote branches (prefixed with remotes/origin/).

3. Check out the new branch:

To switch to the new branch and create a local copy of it, use the git checkout command:

   git checkout branch-name

Replace branch-name with the name of the new branch you want to pull.

4. Pull the latest changes from the new branch:

After checking out the branch, you can pull the latest changes from the remote repository using:

   git pull origin branch-name

Now you're on the new branch and have pulled the latest changes from GitHub.

Categories: GIT

Leave a Reply

Your email address will not be published.