Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on Is it a good idea to have a permanent branch for a feature?

Parent

Is it a good idea to have a permanent branch for a feature?

+7
−0

I'm rather new to using git, so I'm not sure about the best practices regarding it. I have a feature branch branched off, and periodically when the feature needs to be updated I will add some commits to the branch and then create a pull request.[1]

Is it a good idea to have a permanent branch for this feature, or should I delete it after merging and create a new branch whenever an issue comes up? Right now I'm doing the former, but I've also heard that branches should have a single purpose so I'm not sure if it's actually a good idea.

Basically, should I do

  • Update feature branch -> Merge -> Update feature branch -> Merge

    ---O--O---O--O----O---
        \__\_/____\__/____
    

or

  • Create feature branch -> Merge and delete branch -> Create new branch -> Merge and delete branch

    ---O--O---O-O-----O---
        \__\_/   \___/
    

  1. It's for the Code Golf leaderboard, if you were wondering. ↩︎

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+0
−1

You may know me so I am answering :P (someone close to you but you can't find me directly).

Is it a good idea to have a permanent branch for a feature?

Suppose, you have a permanent branch then you had PR 1 years later. Of course, there will be lots of changes in develop branch. But, you forgot to merge them in your branch. Suppose, in that PR you had made changes to line 10 page B. But, in develop branch they had deleted those lines and, they don't need those things anymore. So, your PR is useless. But, if go to merge develop to your branch then your PR then your code will be lost either.

Making the time more shorter : Now, you are going to PR 5 days later. Suppose, the following code was looking like this in your branch.

if(a<b){
   System.out.println(b+" is greater than "+a);
}

You had commited that [1]

if(a<b){
   System.out.println(a+" is less than "+b);
}

But, in develop staffs had already done that. Or, removed SOUT and added something else. If you go to merge then your commit will be lost.

If you just commit in page A and, other developers don't touch that page than you can permanently use a branch rather than creating new ones. Cause, it won't affect much more. Most of your commit was on Codegolf.js so, if you want you can use a permanent branch. But, if you want to work on other files then you can use "temporarily" branch.


  1. I know both context represent same thing. I am just giving an example. ↩︎

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

That's about the weirdest -- and slightly creepy -- intro to an answer i have ever seen on any Q&A site... (1 comment)
That's about the weirdest -- and slightly creepy -- intro to an answer i have ever seen on any Q&A site...
elgonzo‭ wrote over 3 years ago

Just weird.....