by Sai gowtham

How to change a local branch tracking to Different remote in Git

In this tutorial, we will learn how to change an existing local branch tracking to a different remote in git.

Change tracking

We can change a local branch tracking to the new remote by using the git push command followed by -u flag and origin your-branch-name.

git push -u origin your-branch-name

your-branch-name should be your local branch name like dev or working, etc.

The -u flag sets the upstream (tracking) reference to a remote branch.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course