Software development, there are always endless new features to constantly added.
When you add a new feature, because you certainly do not want some experimental nature of the code, the main branch messing up, so, each adding a new feature, it is best to create a new feature branch, developed above, after completion of the merger, and finally, remove the feature branch.
Now, you finally received a new task: to develop new features, code-named Vulcan, which features planned for the next generation starship.
So ready to develop:
$ git checkout -b feature-vulcan
Switched to a new branch 'feature-vulcan'
After 5 minutes, the development is completed:
$ git add vulcan.py
$ git status
On branch feature-vulcan
Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: vulcan.py $ git commit -m "add feature vulcan" [feature-vulcan 287773e] add feature vulcan 1 file changed, 2 insertions(+) create mode 100644 vulcan.py
Cut back dev
, ready to merge:
$ git checkout dev
All goes well, feature branches and branch bug is similar to, merge, and then delete it.
but!
At this time, received a superior command, due to lack of funding, new features must be canceled!
Although White did, but this branch or that contain confidential information must be destroyed in situ:
$ git branch -d feature-vulcan
error: The branch 'feature-vulcan' is not fully merged. If you are sure you want to delete it, run 'git branch -D feature-vulcan'.
Destruction failed. Git Friendly reminder, feature-vulcan
the branch has not been consolidated, if you delete, you will lose out modification, if you want to forcibly remove the need to use uppercase -D
parameter. .
Now we are forcibly removed:
$ git branch -D feature-vulcan
Deleted branch feature-vulcan (was 287773e).
Finally deleted successfully!
summary
The development of a new feature, the best to create a new branch;
If you want to discard a branch had not merged, it can git branch -D <name>
forcibly remove.