this post was submitted on 31 Jan 2024
211 points (98.6% liked)

Git

2632 readers
10 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 14 points 8 months ago (2 children)

Merge. One of the values of a VCS is to preserve history in detail, and merge is the only method that does that. Also, it's easy to foul a remote branch with the other methods if someone has already pushed changes to branch 1.

[–] [email protected] 3 points 8 months ago

Shared branches should always only move forward. Most Git-* systems support stuff like protected branches.

I personally like tidying up your own feature branch with rebasing and then merging it into main (preferably using only FF merges). However this is not scalable for some larger projects, and for example monorepos also make this hard to accomplish. In those cases the solution ends up being squash+merge.

The extra information about the squashed commits is usually persisted to these systems (GitHub PRs, GitLab MRs, etc) so you don't really lose much, I guess. Although I do prefer keeping it all in plain git.

load more comments (1 replies)