Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
GitLab
SourceForge
Launchpad
Phabricator
Gogs
Beanstalk
GitKraken
Launchpad
AWS CodeCommit
Gitea
 Rhodecode
 :) Hot Jobs
 
 :) Latest Articles


  

 


How can you rename a Local or Remote Branch in Git?
Question Posted on 12 Mar 2022

Home >> Repository Questions >> Git Questions >> How can you rename a Local or Remote Branch in Git?




How can you rename a Local or Remote Branch in Git?
Git is one of the famous version control system which is used by software developers to keep track changes in their application and collaborate with others. One of the main feature of Git is branches.
Here different people works on different branches before merging their changes with the original code.
And you can add new features or fix bugs on a different branch without affecting to the original code.
And there are certain situation when you need to change the name of local branch or the remote branch. Below are the steps to change the name of branches:-

(1)Rename a local git branch:-

(i)In first step to see branche run below command
git branch --list or git branch -a

(ii)Now in second step switch to branch you want to rename by below command
git checkout branch-name

or we can use below command to switch to branch
git switch branch-name

(iii)In last step we will run the command to rename the branch
git branch -m new-name


(2)Rename a Remote git branch:-Rename a Remote banch is not same as local branch.
(1)In first step delete the old name by running below command
git push origin --delete old-branch-name

(2)In second and last step reset the upstream branch to the name of your new local branch by running below command
git push origin -u new-branch-name

And to check this rename log into your client website and check the repo.
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Why Git is fast and which language is used in GIT?
What is syntax to fix a broken commit in GIT?
What is GitLive new features that will change the game?
What is Subgit and what is the use of this?
Difference between Git and SVN






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |