From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Arnaud Bertrand <arnaud.bertrand@abalgo.com>
Cc: git@vger.kernel.org, gitster@pobox.com, Arnaud Bertrand <xda@abalgo.com>
Subject: Re: [RFC PATCH 0/1] *** Add branchname in commit header ***
Date: Mon, 30 Dec 2019 02:32:50 +0000 [thread overview]
Message-ID: <20191230023250.GC6570@camp.crustytoothpaste.net> (raw)
In-Reply-To: <20191229222633.23815-1-arnaud.bertrand@abalgo.com>
[-- Attachment #1: Type: text/plain, Size: 3146 bytes --]
On 2019-12-29 at 22:26:32, Arnaud Bertrand wrote:
> From: Arnaud Bertrand <xda@abalgo.com>
>
> For tracability purpose it is often necessary to know which
> commit is envolved in a branch
> Keeping track of the branchname in the commit header
> will make this traceability easy and will facilitate
> the graphical toolis that represent the branches and
> that have today to use complex algorithm to try to
> determine the branch of a commit that was known at
> the commit time.
>
> no big change in the code, today rebase is not considered yet
> I'm waiting feedback about that before touching
> the rebase code.
I encourage you to read back in the history of the list as to why we
haven't done this and why it's not likely to be accepted now, but let me
provide a few reasons of my own.
First, as any contributor to the mailing list can tell you, I am
absolutely terrible at naming things. I frequently name my branches
something that makes sense to me at the time without regard to whether
that will make sense in the future. I don't want to memorialize my
momentary thoughtlessness in the history of the repository forever.
Second, one workflow I commonly use is creating a branch with many
commits and then breaking them down into small series that are logical
and easy for review. If I have a branch called "test-fixes-part7" with
50 commits and then I decide to split that into two branches,
test-fixes-part7 and test-fixes-part8, by copying the branch and using
git reset --hard to truncate the old one, I don't want the old branch
name in my new branch. A lot of Git workflows assume you can reset and
rename branches this way and having the branch name in the commit header
breaks those workflows.
Third, people reuse branch names. Right now, I have eight branches with
test fixes all starting with "test-fixes-part" because I'm working on
one major project with all of those test fixes. However, if a developer
working on another major project also has a lot of changes to the test
suite, they may have lots of identically named branches, which would be
confusing, since our identically named test fix branches would relate to
different projects. (See my first point.)
However, despite the fact that we aren't likely to add this in the
commit header, there are definitely ways to achieve this.
If you want to include the branch name in the commit, you can do so with
a trailer. git interpret-trailers can then be used to manipulate and
extract these, and along with a hook, add them automatically if they're
missing.
If you're working on a more centralized project and you want to require
the branch name in your commit trailers, you can set your CI system to
fail or reject commits that don't contain them. This is the approach
that systems like Gerrit use when the required trailers are missing and
it seems to work reasonably well.
Hopefully these suggestions are helpful in getting you the traceability
you desire without requiring fundamental changes to the way Git works.
--
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]
next prev parent reply other threads:[~2019-12-30 2:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-29 22:26 [RFC PATCH 0/1] *** Add branchname in commit header *** Arnaud Bertrand
2019-12-29 22:26 ` [RFC PATCH 1/1] Add branchname in commit header Arnaud Bertrand
2019-12-30 2:32 ` brian m. carlson [this message]
2019-12-30 10:33 ` [RFC PATCH 0/1] *** Add branchname in commit header *** Arnaud Bertrand
2019-12-30 16:32 ` [RFC PATCH 0/2 v2] *** Add branchname in commit when core.branchnameincommit is set *** Arnaud Bertrand
2019-12-30 16:32 ` [RFC PATCH 1/2 v2] Add branchname in commit header Arnaud Bertrand
2019-12-30 16:32 ` [RFC PATCH 2/2 v2] Add the configuration parameter core.branchnameincommit Arnaud Bertrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191230023250.GC6570@camp.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=arnaud.bertrand@abalgo.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=xda@abalgo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).