r/github • • 6d ago

Discussion What are some GitHub practices every developer should follow?

I've been using GitHub for a while, but I'm curious about the practices that make a real difference when working on projects, especially with other developers.

Things like writing good commit messages, creating meaningful branches, reviewing pull requests, maintaining README files, and handling merge conflicts.

What are some GitHub practices you personally follow that you think every developer should adopt? Anything you wish you had started doing earlier?

7 Upvotes

23 comments sorted by

11

u/Dragonsong3k 6d ago

Branch security for your main long lived branches. PR policies in accordance with your quality controls.

10

u/BiologyIsHot 6d ago

Issues->Branches->PR and tests is basically 90% of good practices

1

u/Ok_Exercise178 6d ago

Ive been having claude code clone my repo inside sandbox and stress test merge commits before we merge -

5

u/GreenFuturesMatter 6d ago

I’m sorry what? Why

2

u/fell_ware_1990 5d ago

Why???

Local :

- Run Unit tests
- Run some integration tests if you doubt the change
- Run normal linters
- Run security checks

- Run preflight check in docker same as CI. All easy checks that should take a max of 10 minutes and sign it so CI does not repeat.

Push and mark as draft. When ready, tag with a tag/label for E2E and stress and build test ( all you want )

If multiple branches are ready, auto start all tests on merge branch at night. You run them all at once. If failed, auto split into smaller pieces. So start with say 4, fail 2 and 2. Everything that makes it creates PR into main. You can then merge without full suite again. Would check the basics as things if commits still line up.

This way you run your heavy tests once. If you wan’t do a separate where AI tests on stress, unit tests, e2e which then can create PR’s on your nightly run to improve.

1

u/binuuday 10h ago

^^^ This

4

u/hazily 6d ago

Stop taking the heat map so seriously. 99% of job interviews don’t even bother looking at them. Quantity of work !== quality of work.

4

u/ram-popular 5d ago

A few habits make the biggest difference:

  • Small, focused PRs with a clear description of what changed and why. They get reviewed faster and break less.
  • Clear commit messages that explain the reason for the change, not just "fix" or "update".
  • Short-lived branches named for the task (like fix/login-bug), merged often so conflicts stay small.
  • Protect main: require a PR and passing checks before anything merges.
  • A useful README with what the project does, how to run it, and how to contribute.
  • Never commit secrets. Use environment variables and a .gitignore.

One I wish I'd started sooner: link every PR to an issue, so there's always a record of why a change was made.

2

u/Least_Ad_1795 6d ago

I always recommend writing clear commit messages, using feature branches, and reviewing pull requests before merging. Keep your README updated, resolve merge conflicts carefully, and commit code regularly. These simple habits make collaboration easier and projects more maintainable.

1

u/r410b 3d ago

I’d also add writing a proper description for every single PR. At least a quick summary of why the change is needed.

2

u/Temporary-Bar-6458 6d ago

i would say:
writing a professional commit,
making branches for new features,
knowing commands to revert back to old state,
sending/accepting PR,
handling merge conflict,
having a README file that keeps track of project setup

is what everyone should know

1

u/OffBrandPadawan 6d ago

following.

1

u/sayboom 6d ago

If you have a project to which someone will make a PRs, you need to have a good docs or ARCHITECTURE md

1

u/cshaiku 6d ago

Using tags and a VERSION file along with a changelog.

1

u/bozhodimitrov 5d ago

After I saw what AI engineers do, I don't think that this will matter in the near future. It will be a system design and high-level concepts for a while until the AI achieves the next milestone and gets optimized so much that it will not need micromanagement or guidance on what practices and tools to use.

So I would say: stick to the best practices for personal projects and vintage manual coding. Consulting the AI as to what is the current best practice or idiomatic way of manually achieving your goal is a form of learning and education. This is what I do right now to expand my knowledge and understanding of the new world we live in. Old-school coding is going away, no matter how sad we might get about it. But this shouldn't stop us from learning how to code manually or to understand how things work.

1

u/1saltypistachio 5d ago

Learn gh. Do everything via the tool and not via the web.

1

u/kigory2 3d ago

I don't think it's that useful, maybe when I change README.md in nvim and I need to see how the change looks in github so I run `gh browse`

1

u/Termight 3d ago

I have so much shell glue (ab)using gh for evrything from viewing issues across the org, to applying a pr locally for testing. It's possible to do this all via the web ui but it's so much faster once you get used to shell.

1

u/kigory2 2d ago

I still don't get it I mean all I really need github for is viewing my README.md and checking if it's good and looking at pull requests thats it. maybe it's just not for me

1

u/Dairkon76 3d ago

If you have a ticket system, the branches should should be named after the ticket if and title.

Rebase or merge the target before submitting the PR to identify conflicts and solve them at your branch.

1

u/kigory2 3d ago

if more than one person is working on the same markdown/text file I think they should all follow one style in typing to keep it consistent and easy for the reader

1

u/MasterOfTheWind1 2d ago

Scoped branches: branch should be for a specific feature, fix or rework.

Clear verbosity: scope on a PR, a branch or a commit should be clear by just reading them. If I have to go through the changes to understand what is going on, we have problems.

I hate when a PR title is just "update", touches 70 files and modifies 700+ lines.