문제

I follow https://www.atlassian.com/git/workflows for Git Workflow, so I have master, develop and feature-one branches for my current project.

I have developed some codes in feature-one branch and not committed them yet. Now I like to create another feature branch called feature-two to develop and test some new code.

My problem is that the new, uncommitted code from feature-one branch is available in all branches and when I create a new feature branch (here feature-two) from develop branch, it includes the new codes from feature-one branch too.

  1. How can I get a new branch without the new, uncommitted code from other branches?
  2. How can I delete the feature-one with all its new code and modifications?
도움이 되었습니까?

해결책

Either commit the uncommitted code, so you don’t lose it (remember: uncommitted code does not exist in the Git repository, so deleting it will be permanent!), or you can stash it so you can continue working on it later.

To delete a branch, you can use git branch -d branchname. This will only work if you have merged the changes in somewhere else (e.g. master or develop), so again, you don’t lose any work. If you want to delete it anyway, you can use git branch -D (upper case D) instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top