Reputation: 9912
I am a bit confused about pushing to a repository. I suppose it also depends on the rules of the maintainers of a particular project but I am asking in general.
Say I have a project in GitLab (or Github etc). I have cloned from it and then locally I have checkout to the development branch. Then I created a feature branch in which I developed some feature. I tested it and it seems to be working.
What is the most appropriate way to push this into the repository?
Should I generally first merge the feature branch into the development branch?
If I do this, should I do then git push -u origin develop
?
Or should I push the feature branch as it is (not really sure if this is possible) so that the project has one more feature branch... (I am guessing this is not the appropriate option).
(I should add that later I should integrate this into a CICD environment but this is out of the scope of this question-just for reference).
Upvotes: 0
Views: 68
Reputation: 11
Well, it not something hard. Since you have created a feature branch in your repository all you need to you is commit and push your changes to the feature branch using
git push <REMOTENAME> <BRANCHNAME>
For example
git push origin feature
When you done you can pull a merge request to the develop branch
Upvotes: 1
Reputation: 2854
It's totally fine to push your feature branch as is to its own branch. This way all the progress you make for feature
stays on its own branch until it is ready to be merged into develop
.
Once you are finished developing your feature
branch, you can create a merge request to merge your feature
branch into develop
. This is useful since all your changes are isolated in one branch and it's easy to review what you've done.
If you're developing alone, you can often skip the merge request and merge it directly (since you don't have to wait for anyone to review or approve your code).
Upvotes: 2
Reputation: 11
If you have created a feature branch then you need to commit and push your changes to feature branch and then you need to create a pull request which would need require an approval to get it to merge in develop branch.
Commit Command - git -a -m 'Some Message'
Push - git push (this push would happen to your branch i.e feature branch)
Upvotes: 0