DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

Add existing remote repositories to your git bash

Firstly clone the repositories and then check all the branches using

1. Fetch all remote branches

git fetch origin
Enter fullscreen mode Exit fullscreen mode

Image description

This fetches all the remote branches from the repository. origin is the remote name you're targetting. So if you had an upstream remote name, you can call git fetch upstream.
2. Check your branches ( -a means all ; remote + local))

git branch -a
Enter fullscreen mode Exit fullscreen mode

Image description

Then you can use your desired branch by creating one in your local system while copying all the content from remote branch.

3. Pull changes to your remote branch

git pull origin dev-bn
Enter fullscreen mode Exit fullscreen mode
  • it creates a new branch called dev-bn
  • it pulls changes from origin/dev-bn to that branch

Here our target is to work with the dev-bn branch and thus doing this.

Image description

Image description
Now I can easily switch to my dev-bn branch which is connected to the remote dev-bn branch as well.

Top comments (0)