How To Rename A Local Or Remote Branch In Git ?

preview_player
Показать описание
Git is a version control system that software engineers use to monitor and collaborate on changes to their code.

Branching is a useful feature of Git. Before merging their modifications with the original code, various persons working on a software project might work in distinct branches.

You may even work on a separate branch to add new features and repair issues without impacting the original code.

Because of typos or other issues, you might wish to modify the name of a branch, and that's what I'll teach you how to accomplish in this video.

To rename the branch, run git branch -m new-name
Make sure you verify that the branch has been renamed by running git branch -a to see all branches.

Renaming a remote branch is not as straightforward as renaming a local branch.
1. Delete the old name by running git push origin --delete old-branch-name
2. Reset the upstream branch to the name of your new local branch by running git push origin -u new-branch-name

You are done.

#git #github #githubtutorial
Рекомендации по теме
Комментарии
Автор

How will this affect the commits of the old branch ? Does all the commits will come in the new branch or will it create a single new commit ?

viraingarg
visit shbcf.ru