Most active commenters
  • ytreister(8)
  • bavent(6)
  • focom(3)

←back to thread

35 points Terretta | 38 comments | | HN request time: 1.526s | source | bottom
1. r1cka ◴[] No.45772653[source]
I think people worry too much about branch names. Feature branches are usually ephemeral. Prefix your branch with your personal identifier so I know who is primary on it and worry more about the commit message which will live on indefinitely.
replies(5): >>45772677 #>>45773377 #>>45773466 #>>45774133 #>>45774578 #
2. morkalork ◴[] No.45772677[source]
Yes, please just name the branch after the ticket/issue number so we can all get the context for it and call it a day
replies(3): >>45772963 #>>45773320 #>>45784312 #
3. wara23arish ◴[] No.45772963[source]
I hate issue numbers for branch names. ISSUE-9482 doesn’t really provide much.

Ticket link should always be included in PR description.

But branch names should be descriptive like terraform_dev_create_instance

etc

replies(3): >>45773128 #>>45773171 #>>45784316 #
4. 6LLvveMx2koXfwn ◴[] No.45773128{3}[source]
we do:

  [feature/bug]/ISSUE-NUMBER-summary-of-issue
e.g.:

  bug/psi-456-broken-args-parsing
replies(2): >>45773179 #>>45784322 #
5. jjgreen ◴[] No.45773171{3}[source]
I've worked in a couple of places with <issue ID>-<something descriptive> conventions, moderately useful
replies(2): >>45773317 #>>45775386 #
6. darkwater ◴[] No.45773179{4}[source]
More or less the same here, but we (I?) prefix it with the username as well, so when pulling branches you know who created it.
replies(3): >>45773812 #>>45774594 #>>45784353 #
7. krferriter ◴[] No.45773317{4}[source]
Yes, `issue-10-add-feature-X` style is best.
replies(1): >>45774811 #
8. jasonjmcghee ◴[] No.45773320[source]
This. Linear has the one click or shortcut to grab the generated branch name based on the ticket.

With GitHub setup properly, on PR open, it auto comments the link to the ticket and links to the pr in the ticket.

replies(1): >>45774582 #
9. aizk ◴[] No.45773377[source]
Great point
10. alkonaut ◴[] No.45773466[source]
having feature/username/id-desc is good though. Because at least you can identify why the branch is there. That they are ephemeral doesn't mean that people actually clean them up...
replies(2): >>45774889 #>>45784386 #
11. celticninja ◴[] No.45773812{5}[source]
But the PR and git blame can tell you this so I would never look at the Branch name to find out this information
replies(1): >>45775078 #
12. loevborg ◴[] No.45774133[source]
Correct, I use uuids as branch names, to the chagrin of my teammates
replies(2): >>45774971 #>>45784390 #
13. focom ◴[] No.45774578[source]
Commit message should be ephemeral too. Squashing after a PR should be the default. Only at that moment does the PR/Commit message matter.
replies(2): >>45774768 #>>45780891 #
14. dewey ◴[] No.45774582{3}[source]
This is probably my favorite Linear feature.

1) Cmd + shift + . -> Copy branch name

2) Build feature on that branch name

3) Build / Merge on Github and Linear closes the issue

15. dewey ◴[] No.45774594{5}[source]
A nice benefit of prefixing by your-name/issue-1234-some-description is that many git clients will show it in a folder structure that way and it's easy to differentiate yours from other branches.
16. bavent ◴[] No.45774768[source]
Hard disagree here. GitHub does encourage this sort of thing, but even there for my PRs to be easily reviewable, I like to keep my commits organized and with good messages explaining things. That way the reviewer can walk the commits, and see why each thing was thing was done.

I also like it for myself, when I’m going over my own PRs before asking for a review - I will often amend commits to ensure the work is broken down correctly, each thing that should go together, does.

In a way, stacked PRs are just a higher-level abstraction of this too - same idea, keep work that goes together in the same place.

replies(2): >>45774846 #>>45776441 #
17. bavent ◴[] No.45774811{5}[source]
I have a little script that does this automatically - lists out Jira tickets assigned to me, then when I select one, creates a branch with the ticket number and the title, subbing hyphens for spaces and truncating if needed. It’s handy for when I want to list branches, I can filter on keywords I remember from the ticket name.
18. freedomben ◴[] No.45774846{3}[source]
Fully agree with you here. Blunt squashing is a bandaid to the problem of lazy commits. Commits should IMHO be specific and atomic. Like fixing one bug or implementing one feature. Obviously there are cases where this ideal isn't practical, but the answer is still not squash everything, it's to think for 10 more seconds about the commit and do your best.
replies(1): >>45775032 #
19. delusional ◴[] No.45774889[source]
Either it has commits I care about or it doesn't. Either way, I'm not going to consult the branch name.

If it has commits I care about, then it stays. If it doesn't, It goes. I'm only deleting on the server afterall, people can just push it back.

replies(1): >>45788511 #
20. brettgriffin ◴[] No.45774971[source]
This would infuriate me. You have to index that guid to something yourself. Why wouldn't you at least give yourself some help (your name, issue number, type of change, area of project, etc). Why make your job harder than it needs to be?
21. bavent ◴[] No.45775032{4}[source]
Yeah, I think over use of GitHub, which seems to encourage squash-merging, has led to this where a lot of people I’ve seen treat a PR as essentially one commit - because it ends up being one in the end.

If you keep your PRs small I guess the end result is the same, but even then I like things in individual commits for ease of review.

replies(2): >>45775099 #>>45776452 #
22. darkwater ◴[] No.45775078{6}[source]
For me is useful when I run 'git fetch' from the command line. I don't use any graphical git client
23. danielbln ◴[] No.45775099{5}[source]
I want to see detailed atomic commits during PR review, and once it's reviewed I'm happy to have it squashed. If the PR produces so much code/changes that main branch needs detailed atomic commits for future reference, then the PR was too large to begin with, imo.
replies(1): >>45775235 #
24. bavent ◴[] No.45775235{6}[source]
I do agree that this is a good compromise. For me, if I do a git blame and eventually can find the PR that led to change, if it has nice clean commits, that’s good enough.
25. johntash ◴[] No.45775386{4}[source]
That's been my preference at most places I've worked. issue id so the branch gets linked to jira or whatever and a short description to find the branch later if needed.
26. focom ◴[] No.45776441{3}[source]
> In a way, stacked PRs are just a higher-level abstraction of this too - same idea, keep work that goes together in the same place.

You downvote me but you just agreed with me. When was the last time you read individual commits of a PR? If your PR need to keep the history of the commits that means that you should split your PR into smaller one.

replies(1): >>45778858 #
27. focom ◴[] No.45776452{5}[source]
> If you keep your PRs small

Its not a if. it's necessary for the sake of people reviewing your code. Unless you work alone on your pet project and always push to master you never work alone.

replies(1): >>45777785 #
28. bavent ◴[] No.45777785{6}[source]
Right, small PRs are great. And they are even better with a nice commit history for me to follow. One does not exclude the other.
29. bavent ◴[] No.45778858{4}[source]
Calm down dude, I can’t even downvote people.

The last time I read individual commits of a PR? Maybe two hours ago. Before that, maybe five hours ago. Not everyone works like you do. Some people like clean commits. As I said, it’s very helpful when reviewing a PR, for me. I never said it was helpful for you.

30. xorcist ◴[] No.45780891[source]
Did you mean before the PR? Why would anyone have a review system if you change the code after review?

Hopefully the commits are already squashed and rebased before review to value reviewers' time.

31. ytreister ◴[] No.45784312[source]
That is what gibr does, it helps you do this with ease
32. ytreister ◴[] No.45784316{3}[source]
gibr makes it easy to do this and in a consistent manner
33. ytreister ◴[] No.45784322{4}[source]
gibr makes it super easy to do exactly this!
34. ytreister ◴[] No.45784353{5}[source]
I added a new TODO issue so that username can be configured in the branch name. gibr currently does not have support for username.

https://github.com/ytreister/gibr/issues/42

replies(1): >>45796744 #
35. ytreister ◴[] No.45784386[source]
Exactly, people tend to leave messes. It makes it much easier to know what the branch was for and have more piece of mind when you want to delete it.
36. ytreister ◴[] No.45784390[source]
Why would you do this!!!!!
37. ytreister ◴[] No.45788511{3}[source]
I understand, but that means you need to review the commits and code changes and do not have the context which could be found either in the issue title, description, etc.
38. ytreister ◴[] No.45796744{6}[source]
I implemented this in version 0.6.0 which was just released. https://github.com/ytreister/gibr/releases/tag/0.6.0 The issue assignee can be used in the branch name.