git change origin branch code example
Example 1: git match remote master
git fetch origin
git reset --hard origin/master
Example 2: git change origin
$ git remote -v
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)
Change your remote\'s URL from HTTPS to SSH with the git remote set-url command.
$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
Verify that the remote URL has changed.
$ git remote -v
# Verify new remote URL
> origin git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin git@github.com:USERNAME/REPOSITORY.git (push)
Example 3: git bash upstream branch change
git branch --set-upstream-to=origin/branch
Example 4: rename branch git
git branch -m <new_name>
git branch -m <select_branch_name> <new_branch_name>
Example 5: git bash upstream branch change
git config --edit
Example 6: git replace with origin branch
git reset --hard origin/<branch-name>