Warning: Reader is strongly encouraged to take a backup of the local repository before performing the steps mentioned in this post.
This post is intended to guide the reader about how to change the name of a remote branch in Github. Suppose there is a branch named
Remote:
Local:
* Command(s):
- git branch -v (Shows a list of all branches, with current branch highlighted)
With the branch
* Command(s):
- git branch -v (Shows a list of all branches, with current branch highlighted)
Push the branch on the remote server, and then delete the older branch from both remote and local repositories.
* Command(s):
- git push --set-upstream origin test/branch_a (link locally create branch to the remote server, and push it)
- git push origin :feature/branch_a test/branch_a (Deletes branch from remote and replaces it with the new one)
That is it! You are good to go.
Enjoy!
This post is intended to guide the reader about how to change the name of a remote branch in Github. Suppose there is a branch named
feature/branch_a
, and it is to be renamed to test/branch_a
. The initial remote and local repositories may look something like this:Remote:
Local:
* Command(s):
- git branch -v (Shows a list of all branches, with current branch highlighted)
With the branch
feature/branch_a
checked out, create a new branch with the name test/branch_a
. * Command(s):
- git branch -v (Shows a list of all branches, with current branch highlighted)
- git checkout -b test/branch_a (Creates a new branch and at the same time switches to the branch)
Push the branch on the remote server, and then delete the older branch from both remote and local repositories.
* Command(s):
- git push --set-upstream origin test/branch_a (link locally create branch to the remote server, and push it)
- git push origin :feature/branch_a test/branch_a (Deletes branch from remote and replaces it with the new one)
That is it! You are good to go.
Enjoy!
No comments:
Post a Comment