Can't push feature branch in git, doesn't

2019-07-20 07:54发布

问题:

I created a feature branch off of develop. It looks like this:

Previously when I made a feature branch, it also showed up on the remote, but now it's not present. Now, when I try to push in SourceTree, I get the following error:

To https://myname-mycompany@bitbucket.org/mycompany/projectname.git
 ! [remote rejected] feature/data_utilities -> feature/data_utilities (failed to write)
error: failed to push some refs to 'https://myname-mycompany@bitbucket.org/mycompany/projectname.git'

I also tried the command line...

git push origin feature/data_utilities

...but I got the same results. When I look on BitBucket, the feature branch doesn't exist.

回答1:

I don't use BitBucket, but the process for creating a feature branch from the command line is very simple.

git checkout develop
git checkout -B feature_branch
  # This command creates a new branch and switches context to the newly created branch
git push -u origin feature_branch
  # This will create the branch on origin and set it up to be a tracking branch