Accidentally did a branch origin set up to track local branch

I accidentally did:

git checkout mybranch
git branch --set-upstream origin mybranch 

Git says:

  • How to provide username and password when run “git clone git@remote.git”?
  • How to save password with Git ssh-agent
  • changing file permission to 770 in git
  • origin does not appear to be a git repository
  • How do i sync/update files using git master stored in dropbox among different computers?
  • How to create new branch in a remote?
  • Branch origin set up to track local branch mybranch.
    

    How do I reset that and what could it do to me?

    Thanks,

  • Is `git reset --hard` required before mark the current commit as good or bad during bisect?
  • Git/GitHub can't push to master
  • How to swap the content of a file in the working directory with the content of a previously staged version of this file?
  • Best practices for using docker in an air-gapped environment
  • Why is my git repository so big?
  • Checkout all files from a previous commit with a certain file name
  • 2 Solutions collect form web for “Accidentally did a branch origin set up to track local branch”

    If all else fails, just edit .git/config with text editor. All the command does is set there

    [branch "origin"]
    merge=refs/heads/mybranch
    

    so just remove the invalid setting.

    That means you just have a local branch that is set to be tracking the remote branch with the same name. No harm in having that, you are not forced to use the remote branch;)

    You can remove the tracking link with

    --no-track
    

    or delete the remote branch:

    git push origin :branch-name
    

    For the latter, if you want to, you need to specifically remove the branch with the -d option.

    Git Baby is a git and github fan, let's start git clone.