Giter Site home page Giter Site logo

Comments (5)

sQVe avatar sQVe commented on July 26, 2024 2

Closing this as I think we've established a strategy for our PRs.

from destiny.

kiprasmel avatar kiprasmel commented on July 26, 2024 1

What I do myself & highly recommend too:

Use feature branches for features
Once the feature is done, rebase it to origin/master
Then merge it into master with --no-ff to intentionally create a merge commit.

This produces a very clean commit history - you know which commits came from a specific feature branch, and which ones were commited straight into master.

Take a look at my recent project as an example -- https://github.com/sarpik/turbo-schedule

image

The workflow looks as follows:

git checkout master
git pull
git push # do not have unpushed commits

git checkout -b feat/my-dank-feature
# develop
# commit
git fetch
git rebase -i origin/master
# rebase interactively - you can even rename the commit messages to comply
# with semantic versioning via REWORD etc.

# either

# a) merge via
git checkout master
git pull
git merge --no-ff feat/my-dank-feature

# or b)
git push -u origin feat/my-dank-feature
# and create a PR & merge it from github
# (without additional rebasing/squashing, since we've already rebased)

# I highly prefer the b) approach - by creating a PR, you get additional benefits -
# you can later link to it, see the commits & changed files more clearly, discuss etc.

and that's it!

Also, I'd recommend ditching the develop branch for projects that do not have bigger teams & do not require multiple change previews before merging into master. It just slows you down, your hotfixes, releases & the synchronization between the master & develop branches becomes a mess, and the whole commit history becomes wrangled & unclear.
In the workflow example above - you automatically avoid the develop branch, since you're only creating feature branches straight from master.


P.S. The commit log is produced via git lg:

[alias]
	lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

(~/.gitconfig from https://github.com/sarpik/voidrice/blob/master/.gitconfig)

from destiny.

danielpza avatar danielpza commented on July 26, 2024 1

I was aiming for something like this, it is what I use on all of my personal projects and it is imo cleaner and straightforward, no develop, just a master branch

image

notice PRs closed with squash merge have a #PR number in the commit

from destiny.

sQVe avatar sQVe commented on July 26, 2024

I agree that we should squash in cases where PRs do not use conventional commits or the commit messages does not make sense.

In cases where the PRs is using conventional commits correctly I would prefer to simply merge instead of rebase as it gives a clearer tree of what actually happened.

Why are you preferring rebase over merge in that case. Is it just to keep the structure flat?

from destiny.

danielpza avatar danielpza commented on July 26, 2024

Yes, just to keep the structure flat, I've use it in my workflows it it seems really nice, however I can see why you wouldn't want to do a rebase.

from destiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.