This post will explain the method to stop tracking a Centralized server branch in Git.
How Do You Stop Tracking a GitHub Branch in Git?
Implement the following steps to stop the tracking branches in Git:
- Go to the Git root directory.
- List all existing remote tracking branches.
- Run the “git branch -d -r <remote-tracking-branch>” command.
Step 1: Move to Git Root Repository
At first, execute the “cd” command with the root directory path and navigate to it:
Step 2: List All Tracking Branches
Then, use the “git branch” command along with the “-vv” option to display the list of all branches with commit detail including tracking:
It can be seen in the below-given output, the highlighted branch “origin/master” is set as a tracking branch:
Step 3: Delete Tracking a Remote Branch
Now, run the following command to stop the tracking of a remote branch process in Git:
Here, the “-d” indicates the “delete”, the “-r” is used for recursively and “origin/master” is the remote tracking branch:
Step 4: Verification
Lastly, to ensure that the tracking of a remote branch is stopped or not, use the below-stated command:
According to the provided output, the previously settle tracking a remote branch procedure stopped successfully:
That’s all! We have explained the method to end tracking a remote branch in Git.
Conclusion
To stop the tracking remote branch in Git, first, move to the Git root directory and list the remote tracking branches. Then, execute the “git branch -d -r <remote-tracking-branch>” command. This post illustrated the way to stop tracking GitHub branches in Git.