Now I want to change the name of the branch from dev to development, I know how to rename branch in GIT. My question is like if I rename the branch, does commit history to the dev-branch will be lost or not? If yes, how do i keep my commit-history?
You can simply create a new branch from your dev
branch, and then delete the dev
branch. The new branch will be a copy of your existing branch, I often do this to guard against breaking a branch when rebasing, or merging.
Here's a sample output:
# Normal state, for me at least
$ git branch
=> master
# Get into your dev branch.
$ git checkout dev
=> dev
# Now we make a new branch `development' based on `dev'
$ git checkout -b development
=> development
$ git branch -d dev
You can always check the git log
before the last step, if you prefer. But all branches in Git are just special tagged references. Creating development
from dev
doesn't duplicate everything, so you don't waste any space by keeping it.