Hello all Committers, please be extra careful when using the "Squash and Merge" Option on github. It is broken regarding author information.
When you use the option, github tries to be clever and uses the public information of the author as present in the profile of the person on github. This results mostly in utterly useless information - see for an example commit (chosen as it is the most recent sample and the work is good): e978ba9b235ca1eaeb6f6fddf7dca46c20c337fc https://github.com/apache/netbeans/commit/e978ba9b235ca1eaeb6f6fddf7dca46c20c337fc The author information is Karl T <[email protected]> If you look into the original PR branch, you see the full author information: Karl Tauber <[email protected]> That is helpful and allows to identify the author. As a contributor this is easily prevented: use valid real world information in the profile and ensure an email address is marked as public. As a committer drop the github GUI and squash manually: 1. Modify your git configuration of the repository to include the github pull requests. In my case this looks like this: [remote "github"] url = https://github.com/apache/netbeans.git fetch = +refs/heads/*:refs/remotes/github/* fetch = +refs/pull/*/head:refs/remotes/github/pr/* 2. You can now fetch from github and will also get the PRs - sample: matthias@athena:~/src/netbeans$ git fetch github remote: Enumerating objects: 132, done. remote: Counting objects: 100% (132/132), done. remote: Compressing objects: 100% (42/42), done. remote: Total 150 (delta 59), reused 122 (delta 51), pack-reused 18 Empfange Objekte: 100% (150/150), 31.75 KiB | 10.58 MiB/s, Fertig. Löse Unterschiede auf: 100% (59/59), abgeschlossen mit 31 lokalen Objekten. Von https://github.com/apache/netbeans 8e2aa441a2f7..21691f5cbf68 master -> github/master + 05b76b069b6e...1cd74c3c90d0 refs/pull/1559/head -> github/pr/1559 (Aktualisierung erzwungen) + 4589bd05e462...771f1a9d5368 refs/pull/1643/head -> github/pr/1643 (Aktualisierung erzwungen) + f55b055eaccd...c8a53a038e51 refs/pull/1765/head -> github/pr/1765 (Aktualisierung erzwungen) d11c6bf5d20d..7a42cbc99cab refs/pull/1771/head -> github/pr/1771 * [neue Referenz] refs/pull/1772/head -> github/pr/1772 matthias@athena:~/src/netbeans$ 3. Ensure your master branch is current git checkout master git pull 4. Checkout the PR: git checkout github/pr/1771 5. Rebase the PR onto master git rebase master 6. Do the squashing - get an overview how far back you need to go (the last 20 commits with author): git log --pretty="%h%x09%ae%x09%s" -n 20 7. Do an interactive rebase (in this case the last 6 commits will be included): git rebase -i HEAD~6 8. Your editor is opened with the commits listed - you can now apply different commands to do a sane squasing, change the default `pick` to `s` (short for squash) pick 213fefed1af0 [NETBEANS-3428] FlatLaf: UI delegates for editor and view [...] s b66a05ff095c [NETBEANS-3428] FlatLaf: fix editor and view tabs painting is[...] s 3ffacc5bc969 [NETBEANS-3428] FlatLaf: removed no longer needed class NbFla[...] s 32852d80343b [NETBEANS-3428] FlatLaf: give HeapView better colors in FlatL[...] s 952e39847f2e [NETBEANS-3428] FlatLaf: - increase major release version of [...] s dc439be5df98 [NETBEANS-3428] FlatLaf: - avoid using `com.formdev.flatlaf.u[...] 9. Save the result and exit editor 10. You are asked to create a new commit message and prepares it by including all commit messages of the commits you are squashing 11. Check the author (shown in the comment section at the bottom 12. Save and exit editor 13. The commit of the new commit will be shown (here: c20b63503c98): matthias@athena:~/src/netbeans$ git rebase -i HEAD~6 [losgelöster HEAD c20b63503c98] [NETBEANS-3428] FlatLaf: UI delegates for editor and view tabs in main window Author: Karl Tauber <[email protected]> Date: Tue Dec 10 19:52:42 2019 +0100 17 files changed, 1546 insertions(+), 41 deletions(-) 14. Switch back to master git checkout master 15. Merge (commit hash from above): git merge c20b63503c98 16. Push git push Do this multiple times with test sets, then its _very_ easy. The alternative is of course to ask the author to do the squash himself, he can update the PR (requires a forced push) Greetings Matthias --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
